iwantcoding.com
🔥 Daily 👥 Rooms 🏆 Top Log in Sign up

Python Glossary

Pythonic jargon — words that come up in books, talks, and code review comments. Learn them once and the docs make a lot more sense.

The big ones

TermMeans
PythonicIdiomatic — written the way a fluent Python coder would.
Duck typing"If it quacks like a duck…" — accept anything with the right methods, regardless of type.
EAFP"Easier to Ask Forgiveness than Permission" — try the operation; catch if it fails.
LBYL"Look Before You Leap" — check preconditions first. Less Pythonic than EAFP.
Dunder"Double underscore" name like __init__ or __len__. Wires into a protocol.
IterableAnything you can for-loop over.
IteratorStateful object that produces values one at a time (__next__).
GeneratorFunction with yield — produces an iterator.
DecoratorFunction that wraps another function, used with @ syntax.
Context managerObject usable with with — has __enter__ and __exit__.
HashableHas a stable __hash__ — can be a dict key or set member. Immutables qualify.
Mutable / ImmutableCan / can't be changed after creation.
GILGlobal Interpreter Lock — only one Python thread runs Python bytecode at a time. Threads still help I/O, not CPU.
CoroutineFunction declared async def; runs cooperatively via an event loop.
REPLRead–Eval–Print Loop — the interactive python prompt.
venvVirtual environment — project-local Python install.
PEPPython Enhancement Proposal — design doc. PEP 8 is the style guide.
Type hintOptional annotation read by tools (mypy, pyright); not enforced at runtime.
Slicings[start:stop:step] on any sequence.
Comprehension[expr for x in iter if cond] — concise builder syntax.
WalrusThe := operator (assignment in an expression).
Tip: Two phrases keep coming up: "There should be one — and preferably only one — obvious way to do it" and "flat is better than nested". Both are from import this — the Zen of Python.

Example

Example
# Some Python jargon worth knowing:
# - dunder: a double-underscore name like __init__
# - iterable: anything you can loop over
# - generator: a function with yield
# - decorator: function that wraps a function
# - context manager: works with 'with'
print('See the matching lesson for each.')
Try it Yourself »

Exercise

A "dunder" name has double-…

double-

Test yourself

Q1. EAFP stands for…
Q2. GIL stands for…
Q3. A "dunder" name is…

Discussion

Loading…