Master programming concepts with clear definitions, real code examples, and cross-language comparisons. Search or select a language to begin.
Press / or ⌘K to search from anywhere
Select a language to explore its concepts and terminology
Popular concepts to get you started
del is an object's finaliser. CPython may call it when the last reference disappears. It is unreliable across implementations and interacts badly with cycles. Prefer with and weakref.finalize.
init is the instance initialiser. After new creates the object, init(self, ...) fills in its attributes. It is the method you write for almost every class that holds state.
name is a module's dotted import name. When you run a file as a program, name is "main". The if name == "main": guard runs a block only in that case, not when the file is imported.
new is the real constructor: a static method that allocates (or reuses) an instance and returns it. init then initialises that instance. Most classes never override new.
repr is the unambiguous developer representation of an object, used by the REPL and repr(). str is the readable user representation, used by print and str(). If str is missing, Python falls back to repr.
slots is a class attribute that names the instance fields the class will allow. Instances then skip dict and store those fields in a compact layout, which saves memory and blocks accidental attributes.
Explore terms organized by programming concepts
Use the search bar above to find any programming term, or browse through our language-specific glossaries for detailed explanations.