Underscore data hiding (was python development practices?)
tim.one at home.com
Fri Nov 2 20:05:06 CET 2001
> People keep insisting that the Python development team won't introduce
> changes that break backward compatability.
Who cares what people keep insisting? Certainly not the Python development
Here's the plain truth: Guido considers backward compatibility to be very
important, but not an absolute criterion. There is nothing in Python's
design that rates "absolute" status. Every decision is a tradeoff among
competing desires, and people who want backward compatibility to win every
time are doomed to occasional outrage; ditto people who give infinite weight
to "runtime speed", or "obviousness (to me)", or "saving keystrokes", or
"more like language L", or "runs on 19-bit minicomputers from 1967", etc
That said, Python's name-hiding conventions meet their modest design goals,
and not a one of them has ever been changed. New gimmicks have been added
every few years, most recently that __all__ at module level can be used to
limit the names sucked up by "import *".
> 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).
expected-__tim-to-be-a-mangled-tim-until-he-dies-ly y'rs - tim
More information about the Python-list