Reading and changing attributes with dot notation
Dot notation reads or changes an attribute stored in an object, like print(pet.name) or pet.age = 5. Each object keeps its own values. A missing attribute causes an AttributeError.
Understanding Reading and changing attributes with dot notation in ACARA Digital Technologies Years 9–10
What it does: Setting dog.age only changes the dog object, so cat.age still holds its own original value. If the class never created a colour attribute, Python raises an AttributeError when pet.colour is read. Python uses dot notation: object.attribute. The arrow -> is not used to access attributes in Python. Use dot notation on the left of the equals sign to change an attribute: pet.age = 5. Each object keeps its own attribute values. Changing dog.age does not change cat.age. Attributes are read with a dot: player.score. Square brackets are for lists and dictionaries. print(pet.name) reads an attribute, and pet.age = 5 changes it. Both use dot notation.
Common mistakes: Inside the class, the new object is called self, not pet. The name pet does not exist yet, so this causes a NameError. It should be self.age = a. Without self. this only makes a local variable that disappears when __init__ ends. The object never gets an age attribute, so print(pet.age) causes an AttributeError. It should be self.age = 0.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 629–680) and word search (Modules 629–707).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
object.attributeFill in the Blanks
Spot the Error
Student with a class code? Join your class →