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

Clark C. Evans cce at clarkevans.com
Mon Dec 12 03:47:48 CET 2005


Interesting discussion.  I've been thinking the opposite; that I should
start using __attribute more often for "undocumented, private" member
variables that are implementation details and clearly not part of the
public interface.

I'm curious what people have against it?

On Sun, Dec 11, 2005 at 09:18:04PM -0500, Tim Peters wrote:
| That wasn't quite it.  The original motivation was to help avoid name
| collisions under inheritance period, and especially when writing a
| base class intended for subclassing by other parties

...

| It's even more unreasonable for A's author to have to
| promise, after A's first release, never to change the name of, or
| introduce any new, attribute (A's author dare not, lest the new name
| conflict with a name someone else's subclass used).

About one year ago, I was updating a "shared module" that I wrote about
6-9 months prior.  I added a member variable, and a few days later one
of my applications started to mysteriously fail.  This was a bugger to
track down... name collision problem.

I've since become very sensitive about "from xx import *" as well,
for the same reason -- it tends to cause very nasty bugs when 
the module xx changes to introduce a few more methods, etc.

Best,

Clark


More information about the Python-Dev mailing list