Underscore data hiding (was python development practices?)

Paul Rubin phr-n2001d at nightsong.com
Fri Nov 2 15:24:48 EST 2001


"Tim Peters" <tim.one at home.com> writes:
> > However, I would definitely  be wary of making my code depend upon
> > something like the name-mangling scheme,
> 
> I don't expect it will change (although new gimmicks may be added).
> 
> > which is clearly a hack
> 
> Guido didn't think so (and every complaint ever made about it was made at at
> least once before it was implemented, so the odds of a compelling new
> argument are approximately nil).
> 
> > and actually seems a likely place to see a future change.
> 
> That's only because you think it's a hack <wink>.  Python *used* to have an
> "access" keyword, implementing an elaborate name-visibility scheme of the
> kind some people favor.  Guido dislike it so much he never documented it,
> and eventually ripped out all the code in support of it (making "access" the
> only keyword ever removed).

I'd like to make the argument for removing the name mangling scheme
from the language specification document.  It's fine to leave it in
the implementation and it can be described in an implementation note.
But if someone writes a new Python implementation they shouldn't be
required to do it the same way, if they can find some alternative way
to resolve collisions.  "Portable" (across Python implementations)
applications shouldn't depend on name mangling working the way it does.




More information about the Python-list mailing list