[Python-Dev] Deprecate __ private (was Re: PEP 8 updates/clarifications)
Scott David Daniels
Scott.Daniels at Acm.Org
Mon Dec 12 15:02:31 CET 2005
Jim Fulton wrote:
> Ian Bicking wrote:
>> Jim Fulton wrote:
>>> Ian Bicking wrote:
>>>> Private attributes should have two leading underscores, no
>>>> trailing underscores.
>>>>
>>>> This conflicts with a previous suggestion "Generally, double leading
>>>> underscores should be used only to avoid name conflicts with
>>>> attributes in classes designed to be subclassed." Or perhaps
>>>> "private attributes" needs to be better explained.
...
>> I really really hate double underscores, but I thought I'd let some
>> other people suggest stronger language first....
>
> Can we officially mark __private as a mistake. Perhaps:
> - Strongly discourage it in the style guide
> - Mark it in the language reference as a deprecated feature
> - Generate deprecation warnings when it is used?
> (This might be too much.)
Perhaps "The __ name convention is designed for 'mixins'; as a means of
enforcing "private" it is both ineffective and annoying. For example,
distutils.msvccompiler uses a bunch of instance variables which would I
would like to access in a subclass, but are "unavailable" because the
author could not imagine why I would need them.
--Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-Dev
mailing list