"private" variables a.k.a. name mangling (WAS: What is print? A function?)

Jeremy Bowers jerf at jerf.org
Mon Jan 24 10:56:30 EST 2005

On Mon, 24 Jan 2005 12:17:13 -0600, Philippe C. Martin wrote:
> I use "__"for private variables because I must have read on net it was the
> way to do so - yet this seems to have changed - 

It's still as true as ever, at least in terms of language support, it's
just that the Python community, and in general the dynamic language
community, has become increasingly confident that private variables don't
solve *real* problems. The evidence is primarily a lack of evidence
against, which is why it has taken a while for everyone to be sure, but
while the rare anecdotal bit goes by every now and again, the dynamic
languages have conspicuously failed to crash and burn as old hard-line
theories about variable privacy would have predicted.

I could go on about this for a while, but that's probably enough to
explain the apparent contradiction between docs you may find and what you
heard here; the docs mention that because people look for it, and if
people want to know it, the docs should include it. But that doesn't mean
it's a good idea.

More information about the Python-list mailing list