Will python never intend to support private, protected and public?

Tony Meyer t-meyer at ihug.co.nz
Wed Sep 28 09:29:29 EDT 2005


On 28/09/2005, at 11:55 PM, Simon Brunning wrote:

> On 9/28/05, Tony Meyer <t-meyer at ihug.co.nz> wrote:
>
>> I'm not sure why I haven't seen this mentioned yet, but a leading
>> double-underscore does really make a member private:
>>
>
> 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.

That's not what the documentation says:

"""
9.6 Private Variables

There is limited support for class-private identifiers.
[...]
Name mangling is intended to give classes an easy way to define  
``private'' instance variables and methods,
[...]
"""

<http://docs.python.org/tut/node11.html>

=Tony.Meyer



More information about the Python-list mailing list