difference between variables inside and outside of __init__() (class and instance attributes)

Variable set outside __init__ belong to the class. They’re shared by all instances.

Variables created inside __init__ (and all other method functions) and prefaced with self. belong to the object instance.

Leave a Comment