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

Guido van Rossum guido at python.org
Mon Dec 12 20:19:34 CET 2005

On 12/12/05, Scott David Daniels <Scott.Daniels at acm.org> wrote:
> 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.

But __private's use case is *not* restricted to mixins; this seems to
be a common misconception. It is a tool (not the only one!) for name
conflict avoidance in all inheritance situations, including single

BTW let me note that inheritance is overused. People should get used
to containment patterns (e.g. facade, delegate etc.) in favor of
inheritance patterns.

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list