Why equal to “self.angle” instead of just “angle”?


#1

Why do I need to set self.angle1, self.angle2, and self.angle3 equal to “self.angle” instead of just “angle”?


FAQ: Learn Python - Introduction to Classes - Inheritance
#2

Inheritance

It has to do with converting the class variable to an instance attribute. All instances of Equilateral inherit the class variable and can treat it as an attribute. The instances don’t have an angle variable; they have a self.angle attribute, which can then be assigned to the three instance attributes.