
Excel Cheat Sheet
by Hernando Abella
Essential Excel formulas and functions reference.
Debug slow code
Profile a real function and inspect its bytecode to find bottlenecks.
Why it matters: Use this when an endpoint is slow and you need to see what Python actually executes.
Output: 0.000123 seconds
import dis, timeit
def total(items):
return sum(items)
print(timeit.timeit(lambda: total(range(1000)), number=1000))
dis.dis(total)Avoid memory leaks
Track references in a data pipeline to prevent runaway memory.
Why it matters: Useful when processing large batches and memory keeps growing.
Output: 8056 bytes
import sys
batch = [range(1000) for _ in range(1000)]
print(sys.getsizeof(batch))Ship faster APIs
Use built-ins and C extensions to speed up production endpoints.
Why it matters: Built-ins run in C and avoid Python-level loops.
Output: fast path enabled
def fast_sum(items):
return sum(items)
# CPython optimizes built-insUnderstand decorators
See how decorators wrap functions at runtime.
Why it matters: Helps debug middleware and logging wrappers.
Output: call
def log(fn):
def wrapper(*a, **k):
print('call')
return fn(*a, **k)
return wrapperInspect objects
Explore object layout and attributes in memory.
Why it matters: Useful when serializing or debugging state.
Output: {}
class User:
pass
u = User()
print(u.__dict__)Measure GC
Trigger and observe garbage collection in long jobs.
Why it matters: Prevents memory buildup in long-running workers.
Output: (123, 45, 2)
import gc
gc.collect()
print(gc.get_count())Call C APIs
Extend Python with native modules for speed.
Why it matters: Useful for performance-critical sections.
Output: <CDLL 'libc.so.6'>
import ctypes
lib = ctypes.CDLL('libc.so.6')
print(lib)Read source
Navigate CPython source to answer deep questions.
Why it matters: Find the real implementation behind Python features.
Output: # CPython source path
# CPython source: Objects/listobject.cBuild mental model
Know what happens after you press Run.
Why it matters: Makes debugging and optimization intuitive.
Output: Hello, CPython
print('Hello, CPython')Your place in the path
This book is one piece of the transformation system. Here is how it fits in each career path.
Operate Python, SQL and Excel at a professional level.
More books by Hernando Abella
About the author
Hernando Abella writes practical programming books and tutorials to help developers build real skills, from fundamentals to advanced systems.
