| |
comp.lang.python |
> That's not what the documentation says: > """ > There is limited support for class-private identifiers. without having to worry about instance variables defined by derived and the paragraph later says: Note that the mangling rules are designed mostly to avoid accidents and both sentences are from the *tutorial*, which doesn't exactly http://groups.google.com/group/comp.lang.python/msg/e79f875059d9a2ba "In my version, private data has it's own scope, so that name clashes see the rest of that thread for more about the history of __. </F>
>> I thought about it, but I didn't mention it in the end because this
>> feature ("name mangling") isn't intended as a mechanism for making
>> things private - it's intended to prevent namespace clashes when doing
>> multiple inheritance.
> 9.6 Private Variables
> [...]
> Name mangling is intended to give classes an easy way to define
> ``private'' instance variables and methods,
> [...]
> """
classes
qualify as a design document. if you want more rationale, here's the
post that led to the current design:
will not occur if a private with the same name is used in a subclass."