Why all the __double_underscored_vars__?
no.email at please.post
Fri Aug 7 23:51:39 CEST 2009
Python is chock-full of identifiers beginning and ending with double
underscores, such as __builtin__, __contains__, and __coerce__.
Using underscores to signal that an identifier is somehow "private"
to an implementation is pretty common in languages other than
Python. But in these cases the understanding is that the use of
these variables in external code amounts to "going behind the API",
and is therefore unwise.
But as far as I can tell, Python's double-underscore variables are
very much part of Python's API. E.g., programmers are specifically
instructed to override "double-underscore methods" to achieve
In this case, I wonder: what justifiies the double-underscore
convention? For example, what would be the problem with changing
the name of the complex.__gt__ method to complex.gt?
More information about the Python-list