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 Dennis Sweeney
Recipients Dennis Sweeney, niharranjanroy
Date 2021-05-27.05:04:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1622091840.82.0.7759959804.issue44244@roundup.psfhosted.org>
In-reply-to
Content
Being in different modules is irrelevant. Attribute names that start with double underscores and don't end with double underscores are "mangled" by the compiler to include the class name as well:

>>> class MyClass:
...     def __init__(self):
...         self.__data = 17
... 
...         
>>> x = MyClass()
>>> x._MyClass__data
17


See https://docs.python.org/3/tutorial/classes.html?highlight=mangle#private-variables

I don't think there's a bug here.
History
Date User Action Args
2021-05-27 05:04:00Dennis Sweeneysetrecipients: + Dennis Sweeney, niharranjanroy
2021-05-27 05:04:00Dennis Sweeneysetmessageid: <1622091840.82.0.7759959804.issue44244@roundup.psfhosted.org>
2021-05-27 05:04:00Dennis Sweeneylinkissue44244 messages
2021-05-27 05:04:00Dennis Sweeneycreate