Does Python really follow its philosophy of "Readability counts"?

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Thu Jan 22 09:12:31 EST 2009


Steven D'Aprano a écrit :
> On Thu, 22 Jan 2009 10:33:26 +0100, Bruno Desthuilliers wrote:
> 
>> Steven D'Aprano a écrit :
>>> On Wed, 21 Jan 2009 12:54:31 +0100, Bruno Desthuilliers wrote:
>>>
>>>> Russ P. a écrit :
>>>> (snip)
>>>>> In any case, I have suggested that Python should perhaps get a new
>>>>> keyword, "private" or "priv".
>>>> And quite a few people - most of them using Python daily - answered
>>>> they didn't wan't it.
>>> Then they don't have to use it.
>> Yes they would. Because this would become the official way to tell
>> what's interface and what's implementation, and *this* is the important
>> point.
> 
> But if you have free access to attributes, then *everything* is interface.
> 

Nope.

>>> Lots of people think that double-underscore name mangling is a waste of
>>> time: not strict enough to be useful, not open enough to be Pythonic.
>>> Solution? Don't use double-underscore names.
>> The name-mangling mechanism is actually useful when you want to make
>> sure some vital implementation attribute (usually of a class intented to
>> be extended by the library users) won't be *accidentally* overwritten.
> 
> Except it doesn't.

Except it works for all real-life code I've ever seen.

(snip convoluted counter-example)


Steven, sorry for being so pragmatic, but the fact is that, from 
experience (not only mine - I'm talking about thousands of man/year 
experience), it JustWork(tm).



More information about the Python-list mailing list