R. David Murray added the comment:

Ah, now I understand your confusion.  Class variables are special.  The first 
time you reference a name on an instance that is not currently defined on that 
instance but is defined on the class, the interpreter gets the object pointer 
from the class reference.  It then performs the operation, and assigns the 
result to the *instance* attribute.  This is how class attributes work, and is 
an integral part of Python.  This is documented in the 'class instances' 
section of 
https://docs.python.org/3/reference/datamodel.html#objects-values-and-types.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23824>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to