Python flash cards: Master level

20 Python terms at the Master level, as flash cards.

Updated

Terms in this deck

__init_subclass__
Runs whenever a class inherits from yours; handy for tracking child classes.
__new__
Creates the object itself, just before __init__ fills it in.
__slots__
Lists the only attributes a class's objects may have, saving memory.
Attribute Lookup (__getattr__)
Runs when code asks for an attribute that doesn't exist.
Bytecode
The simpler instructions Python turns your code into before running it.
Class Decorator
A decorator placed on a class to change or register the whole class.
Context Variable (contextvars)
A value that belongs to the current task, so async tasks do not mix up values.
CPython
The standard Python you download from python.org, written in C.
Data Model
The dunder methods that let your objects work with len(), +, for and more.
Descriptor
An object that controls reading and setting an attribute; the machinery behind @property.
Event Loop
The asyncio engine that switches between tasks whenever one is waiting.
Garbage Collector
Frees memory reference counting misses, like objects pointing only at each other.
Global Interpreter Lock (GIL)
Lets only one thread run Python code at a time in standard Python.
Interning
Python keeps one shared copy of some values, like small numbers and short strings.
Introspection (inspect)
A program looking at itself while it runs: types, attributes, function arguments.
Metaclass
The class that builds classes, mostly used inside frameworks.
Method Resolution Order (MRO)
The order Python searches classes to find a method.
Monkey Patching
Replacing a function or method while the program runs.
Reference Counting
Python counts what points to an object and frees it when the count hits zero.
Weak Reference
Points to an object without keeping it alive.

Read them in the glossary