[Python-bugs-list] [ python-Bugs-569257 ] __slots__ attribute and private variable
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 19 Jun 2002 12:30:34 -0700
Bugs item #569257, was opened at 2002-06-14 20:54
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=569257&group_id=5470
Category: Type/class unification
>Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Keyton Weissinger (keytonw)
Assigned to: Guido van Rossum (gvanrossum)
Summary: __slots__ attribute and private variable
Initial Comment:
If you use a __slots__ class variable and include a
variable with a double underscore as the first two
characters, that variable is NOT private as would be the
case for any other variable whose name begins with a
double underscore.
If this is by design, then it should be in the docs. If it is
not and represents a bug, it needs to be investigated.
Thank you!!!
Keyton Weissinger
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2002-06-19 15:30
Message:
Logged In: YES
user_id=6380
rhettinger: I haven't seen the patch, but I agree this ought
to be fixed -- in Python 2.3, as a new feature though. Why
don't you make munge() a private global (with an _Py prefix
to its name).
keytonw: I have no idea what you meant in your comment about
properties and slots and __property_name__. Can you
elaborate that?
----------------------------------------------------------------------
Comment By: Raymond Hettinger (rhettinger)
Date: 2002-06-19 14:13
Message:
Logged In: YES
user_id=80475
Added patch.
Note, the patch would be much shorter if mangle() in
compile.c were made non-static.
----------------------------------------------------------------------
Comment By: Raymond Hettinger (rhettinger)
Date: 2002-06-18 00:19
Message:
Logged In: YES
user_id=80475
Agree that it is a bug.
Working on a patch.
----------------------------------------------------------------------
Comment By: Keyton Weissinger (keytonw)
Date: 2002-06-14 23:31
Message:
Logged In: YES
user_id=396481
Also, this issue prevents you from using the combination of
property() and __slots__ which would be powerful, as
attempting to use them would make __property_name__ a
legal public variable, no?
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=569257&group_id=5470