Eric V. Smith <e...@trueblade.com> added the comment:

Because variable belongs to the class, and not any instance of the class, you 
can duplicate this behavior without creating any instances at all:

>>> class TestClass(object):
...     variable = []
...
>>> TestClass.variable.append(1)
>>> TestClass.variable
[1]

And then when you create an instance t, t.variable still refers to the class:

>>> t = TestClass()
>>> t.variable
[1]
>>>

This is expected behavior.

----------
nosy: +eric.smith
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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

Reply via email to