13.6. Instance Attributes
Instances have only data attributes (methods are strictly class attributes) and are simply data values which you want to be associated with a particular instance of any class and are accessible via the familiar dotted-attribute notation. These values are independent of any other instance or of the class it was instantiated from. When an instance is deallocated, so are its attributes.
13.6.1. “Instantiating” Instance Attributes (or, Creating a Better Constructor)
Instance attributes can be set any time after an instance has been created, in any piece of code that has access to the instance. However, one of the key places where such attributes are set is in the constructor, __init__().
Constructor First Place to Set ...
Get Core Python Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.