Underscore data hiding (was python development practices?)
Skip Montanaro
skip at pobox.com
Wed Oct 31 13:05:11 EST 2001
More information about the Python-list mailing list
Wed Oct 31 13:05:11 EST 2001
- Previous message (by thread): Underscore data hiding (was python development practices?)
- Next message (by thread): Underscore data hiding (was python development practices?)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Russell> My understanding is that a double underscore is required for
Russell> Python to automagically mangle the name. On the other hand, two
Russell> postings now suggest that a single underscore is sufficient.
Russell> If double underscore is required, then it seems to me this is a
Russell> very common misconception that a single is sufficient. It might
Russell> be worth changing.
A double leading underscore is requred to coax Python into mangling an
attribute. I think a lot of people use a single underscore as a simple cue
for themselves and other programmers that an attribute isn't meant to be
part of the public interface without messing up the actual name, so it can
be used easily in subclasses.
--
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/
- Previous message (by thread): Underscore data hiding (was python development practices?)
- Next message (by thread): Underscore data hiding (was python development practices?)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list