Self parameter
A self parameter is a method receiver representing the instance or object on which the method operates or is invoked.
Python Workout: 50 ten-minute exercises
self is the conventional first parameter of a Python instance method that refers to the instance on which the method was invoked.
- How it is used
- Uses self to attach state to instances and let inherited methods select instance- or class-specific attributes.
- How deep it goes
- Explains parameter binding, attribute creation, lookup, inheritance, and object initialization, while stopping short of detailed method-binding internals.
- Examples
- Demonstrates Scoop and Person initialization, Foo attribute access, Bowl lookup, and inherited Animal representations.
- What you can do after
- Apply self in instance methods to initialize attributes, access object state, and reuse behavior across subclasses.
Read how Python Workout: 50 ten-minute exercises explains self parameter →
The Quick Python Book, Fourth Edition
self is the conventional first parameter name that refers to the instance on which a Python method is invoked.
- How it is used
- Uses self to access and initialize the current instance in Python methods.
- How deep it goes
- Explains implicit and explicit instance passing, attribute lookup, and private superclass names.
- Examples
- Demonstrates a Circle initializer and area method, including calls through an instance and its class.
- What you can do after
- Practice defining and calling instance methods that initialize and use instance attributes.
Read how The Quick Python Book, Fourth Edition explains self parameter →
Get Programming: Learn to code with Python
self is the conventional first parameter of a Python instance method that refers to the instance on which the method is called.
- How it is used
- Uses self to connect class methods with each object's data and operations.
- How deep it goes
- Explains declarations, attribute access, automatic argument assignment, and per-instance effects through small class examples.
- Examples
- Uses Circle and Door classes, radius attributes, method calls, independent instances, and short method-writing exercises.
- What you can do after
- Build instance methods that initialize, change, retrieve, and calculate values stored on individual objects.
Read how Get Programming: Learn to code with Python explains self parameter →
Also covered in
- Python Workout, Second Edition
- The Well-Grounded Python Developer: How the pros use Python and Flask
- Learn Rust in a Month of Lunches
What to know first
- attributeAn attribute is a named property or piece of information associated with an entity, object, or structured data item.
- methodA method is a callable function or operation associated with a type, class, or object and invoked through that association.
- comprehensionA comprehension is a language construct that creates a collection by iterating over one or more sources, optionally filtering elements and transforming them.
- default valueA default value is a predefined value automatically applied when no explicit value is supplied or specified.
Related concepts
- methodused by · A method is a callable function or operation associated with a type, class, or object and invoked through that association.
- mutable referencecontrasts with · A mutable reference is a reference or handle that provides access to a value or storage location that can be modified, subject to the language’s access rules.
- objectequivalent to · An object is a distinct entity represented or manipulated within a computational system, typically as a value, data structure, resource, or instance of a type.
- attributeuses · An attribute is a named property or piece of information associated with an entity, object, or structured data item.
- class methodcontrasts with · A class method is a method associated with a class rather than a particular instance and invoked through a class or class-related object.
- private memberuses · A private member is a program element whose direct access is restricted to its defining class, module, file, or other language-defined scope.
Questions about self parameter
What is self parameter?
A self parameter is a method receiver representing the instance or object on which the method operates or is invoked.
Which Manning books explain self parameter?
Python Workout: 50 ten-minute exercises, The Quick Python Book, Fourth Edition and Get Programming: Learn to code with Python.
What should I know before learning self parameter?
Manning books that teach self parameter usually introduce attribute, method, comprehension and default value first.
What is the difference between self parameter and mutable reference?
A self parameter is a method receiver representing the instance or object on which the method operates or is invoked. A mutable reference is a reference or handle that provides access to a value or storage location that can be modified, subject to the language’s access rules.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


