class-private names and the Zen of Python

Marco Buttu marco.buttu at gmail.com
Tue Oct 8 06:47:17 EDT 2013


On 10/08/2013 12:36 PM, Terry Reedy wrote:

> On 10/8/2013 6:13 AM, Marco Buttu wrote:
>> In the following case:
>>
>>  >>> class Foo:
>> ...     _Foo__a = 100
>> ...     __a = 33
>> ...
>>  >>> Foo._Foo__a
>> 33
>>
>> I think this behavior, for a user who does not know the convention,
>> could be a surprise.
>
> No one qualified to use such names would do such a thing , so there is
> no need to worry about it or do anything about it.

Is this transformation performed by the parser, before to call the 
metaclass?

-- 
Marco Buttu



More information about the Python-list mailing list