[Python-Dev] Deprecate __ private (was Re: PEP 8 updates/clarifications)

Nick Coghlan ncoghlan at gmail.com
Mon Dec 12 03:29:01 CET 2005


Neal Norwitz wrote:
> On 12/11/05, Jim Fulton <jim at zope.com> wrote:
>> Can we officially mark __private as a mistake. Perhaps:
>>
>> - Strongly discourage it in the style guide
> 
> This may be acceptable.
> 
>> - Mark it in the language reference as a deprecated feature
>>
>> - Generate deprecation warnings when it is used?
>>    (This might be too much.)
> 
> I recently asked Guido about name mangling wrt Py3k.  He definitely
> wanted to keep it in.  Unless he changed his mind, I doubt he would
> deprecate it.  His rationale was that there needs to be a way to
> handle name collision with multiple inheritance.

Keeping it for Py3K would be fine, if the mechanism was changed so that it 
actually worked right. That is, the mechanics would be such that any two 
concurrently existing classes would be guaranteed to mangle the names of their 
private variables differently - simply using the class name (as now) doesn't 
guarantee that when inheriting from a class in a different module and reusing 
the name.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-Dev mailing list