Common class mistakes: self and attribute errors
Saves a value on the object. Without self. the attribute is lost (AttributeError), and a method missing self as first parameter gives a TypeError for wrong argument count.
Understanding Common class mistakes: self and attribute errors in ACARA Digital Technologies Years 9–10
What it does: Brackets call the class, which runs __init__ and builds the object. Without brackets you only get the class itself. Inside a method, the attribute lives on the object, so you reach it with self.name rather than just name. The attribute was never stored on the object, so Python cannot find it. This gives an AttributeError. dog.bark() secretly passes dog as an argument. With no self parameter to receive it, the argument count is wrong.
Common mistakes: Without self. the value is stored in a local variable that disappears when __init__ ends, so the object has no name attribute and dog.name raises an AttributeError. It should be self.name = name. Every method needs self as its first parameter. Python passes the object in automatically, so cat.speak() raises a TypeError (0 positional arguments but 1 was given). It should be def speak(self):.
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
self.name = nameFill in the Blanks
Spot the Error
Student with a class code? Join your class →