This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.smith
Recipients eric.smith, miedzinski, moird
Date 2019-07-19.01:21:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1563499262.01.0.789576577972.issue37625@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-07-19 01:21:02eric.smithsetrecipients: + eric.smith, miedzinski, moird
2019-07-19 01:21:02eric.smithsetmessageid: <1563499262.01.0.789576577972.issue37625@roundup.psfhosted.org>
2019-07-19 01:21:01eric.smithlinkissue37625 messages
2019-07-19 01:21:01eric.smithcreate