Browse by Topic

Popular

Latest

Latest Python Posts

A Python object with a visible dictionary inside, representing the instance __dict__ that stores attribute names and values.
Python

Understanding Python Instance __dict__

Learn how Python's instance __dict__ stores attributes, how to inspect and modify it, and when __slots__ offers a better memory tradeoff.

Python__dict__object attributes__slots__
Diagram showing a Python class object and an instance, each with its own __dict__ mapping attribute names to values.
Python

Python Class __dict__: Instance and Class Namespaces

Python's __dict__ namespaces hold instance and class attributes. Learn how attribute lookup uses them and when __slots__ removes the instance dictionary.

python__dict__object modelattribute access
Thumbnail showing a Python dictionary as key-value pairs mapped through a hash table metaphor, with clean editorial composition and professional software engineering aesthetics.
Python

Python dict: Dictionary Operations and Performance

A practical guide to Python dict: creation, access, merging, iteration, comprehension, and hash-table performance behavior.

pythondictionariesdata structuresdict methods
Diagram showing attribute lookup flowing from an instance namespace through the class namespace in Python.
Python

Python Object Namespace: How Attribute Lookup Works

Understand how Python object namespaces work: instance __dict__, class attribute lookup, __slots__, and programmatic namespace manipulation.

attribute lookupobject modeldunder methodspython internals
Diagram showing a Python class namespace with attribute lookup flowing from instance to class to base classes
Python

Python Class Namespace: How Attribute Lookup Works

Understand how the Python class namespace works, how attribute lookup resolves names, and how class and instance namespaces differ in real code.

python classesattribute lookupnamespacemethod resolution order
Illustration of a Python unbound method being accessed from a class, showing the transition from Python 2 to Python 3.
Python

Python Unbound Method: What It Is and How It Changed

An unbound method in Python 2 is the object you get when you access an instance method through the class. Python 3 replaces it with a plain function. See what changed and how to handle the difference.

pythonmethod bindingclass methodspython 2 vs 3
Illustration of a Python method being bound to an object instance, showing the connection between function and object.
Python

Python Bound Method: How Instance Methods Work

Understand how Python creates bound methods, why self is passed automatically, and how the descriptor protocol controls method access.

Pythonmethod bindingdescriptor protocolOOP
Diagram showing a Python function object binding to an instance to create a bound method.
Python

Python Method Binding: How Methods Attach to Objects

Learn how Python binds instance methods to objects, how bound method objects use the descriptor protocol, and where classmethod and staticmethod fit in.

descriptorsinstance methodsclass methodsstatic methods
Diagram showing a classmethod receiving the class object while a staticmethod receives no implicit argument, illustrating the Python decorator difference.
Python

Python classmethod vs staticmethod: Key Differences

Learn how Python's classmethod and staticmethod decorators differ: what each receives when called, how inheritance affects the class argument, and when to use each pattern.

classmethodstaticmethodPython decoratorsobject-oriented programming
Illustration of a Python class with a static method symbol, showing the decorator concept.
Python

python staticmethod decorator explained

Learn how the python staticmethod decorator works, when to use it, and how it differs from classmethod and instance methods.

staticmethoddecoratorspython classesclassmethod