Python for JS Devs · Reference
Glossary
The nomenclature of this course. Adhered to in every lesson.
Runtime & internals
- CPython
- The reference Python implementation, written in C — what you run via
python/uv run. The analogue of V8 for Node.
- bytecode
- The intermediate instructions your source compiles to, executed by the interpreter. Inspect with
dis; cached as .pyc in __pycache__/.
- ceval loop
- CPython's bytecode interpreter — the core execution loop. No optimizing JIT by default (unlike V8's TurboFan).
- specializing interpreter
- PEP 659 (Python 3.11+): the interpreter swaps in type-specialized bytecodes with inline caches at runtime — V8's inline-caching idea without a full JIT.
- GIL (Global Interpreter Lock)
- A lock ensuring only one thread runs Python bytecode at a time. Blocks CPU parallelism via threads (use multiprocessing); released during I/O. Optional in 3.14's free-threaded build.
- reference counting
- CPython's primary memory management: each object tracks references; freed immediately when the count hits 0. A separate cyclic GC reclaims reference cycles. (V8 uses a tracing generational GC instead.)
- PyObject
- The C struct behind every Python value (even an int) — carries a type pointer and refcount. Attribute access goes through a dict, not V8-style hidden-class slots.
- PyPy
- Alternative Python implementation with a real tracing JIT — often much faster than CPython (like SpiderMonkey/JSC vs V8).
Language & tooling
- uv
- Fast all-in-one project/package/Python-version manager (npm + nvm + npx in one). Our standard tool.
- venv (virtual environment)
- Per-project isolated folder (
.venv/) holding that project's dependencies and its own interpreter — Python's node_modules. With uv you never manually activate it.
- pyproject.toml
- Project + dependency manifest (Python's
package.json).
- ruff
- Fast linter + formatter from Astral. Our standard.
- REPL
- Interactive Python shell (
uv run python) — the fastest feedback loop.
- module / package
- A
.py file is a module; a folder of modules is a package. Imported with dotted paths (app.routers.users).
- dunder method
- A "double underscore" special method (
__init__, __repr__) that hooks into language features.
- type hint
- An annotation like
x: int. Advisory at runtime (checked by tools), except Pydantic/FastAPI read them to validate.
- comprehension
- One-expression collection builder:
[f(x) for x in xs if g(x)]. Replaces most map/filter.
- dataclass
@dataclass-decorated class that auto-generates __init__/__repr__/__eq__ — a typed struct.
- coroutine
- The object returned by calling an
async def function. Lazy — does nothing until awaited.
- event loop
- The single-threaded scheduler running async tasks. Blocking it freezes all concurrency.
- async generator
- An
async def with yield — a lazy async iterator; the producer behind streaming responses.
Web & FastAPI
- FastAPI
- Type-hint-driven async web framework. Reads your hints to validate requests, serialize responses, and generate docs.
- uvicorn
- The ASGI server that runs a FastAPI app (its
app.listen).
- Pydantic
- Runtime validation/serialization library (like Zod). A
BaseModel validates data against type hints. v2 uses .model_dump().
- pydantic-settings
- Loads env vars into a typed, validated
Settings object; fails fast if required values are missing.
- path / query / body param
- FastAPI infers a param's source: named in the route → path; scalar → query; Pydantic model → body.
- response_model
- Declares and enforces a route's output shape; strips any field not on the model (e.g. secrets).
- dependency injection (Depends)
- A route declares what it needs as a parameter; FastAPI supplies it. Composable, typed, testable middleware.
- HTTPException
- Raise it to abort a handler and return an error response with the right status code.
- APIRouter
- Groups related routes in a module, mounted via
include_router (Express's Router).
- blocking-I/O trap
- Putting a synchronous blocking call inside an
async def route — freezes the event loop. Use def (threadpooled) or an async client.
- SQLAlchemy 2.0
- Standard ORM; modern typed style uses
DeclarativeBase, Mapped[], mapped_column, and select().
- Alembic
- SQLAlchemy's migration tool (the Prisma-migrate / django-migrate equivalent).
- StreamingResponse
- FastAPI response that streams an (async) generator's chunks to the client — used for token streaming and SSE.
- SSE (Server-Sent Events)
- One-way server→client stream over HTTP; each frame is
data: ...\n\n, media type text/event-stream.