Nihar Ranjan Roy <niharranjan...@gmail.com> added the comment:

Dear Dennis
Thanx for the prompt reply.
I am talking about protected members (those starting with single
underscore). Take it other way, What is the difference between public and
private membership in python?

With Regards
Nihar Ranjan Roy
Mobile: +91 9810 977 908
___________________

On Thu, May 27, 2021 at 10:34 AM Dennis Sweeney <rep...@bugs.python.org>
wrote:

>
> Dennis Sweeney <sweeney.dennis...@gmail.com> added the comment:
>
> 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.
>
> ----------
> nosy: +Dennis Sweeney
>
> _______________________________________
> Python tracker <rep...@bugs.python.org>
> <https://bugs.python.org/issue44244>
> _______________________________________
>

----------

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

Reply via email to