there are no variables in python
While it's true that in Python it's more appropriate to talk about names and bindings instead of variables and values, there is a parallel, and you can get a fair distance without having to fully convert to the names/bindings terminology.
That being said, understanding this part of Python can aid enormously in working with the language. If you'd like to think of it in C terms, basically every 'name' in Python is a pointer to a PyObject, and 'names' (as pointers) are always passed by value -- that is, you get a copy of the pointer, but not a copy of the object.
And before you go and wipe out all those double underscores note that python uses double underscores as special methods and other internal details( read the docs).
Just to clarify, I was only talking about removing leading underscores for instance variables, e.g. changing:
self.__xyz
to
self.xyz
As M.E.Farmer mentioned, you can't remove underscores on special method names like __init__. However, when you're declaring an instance variable, e.g.:
self.__xyz = True
then you're choosing the name here, so you can name it whatever you want. The only reason to use leading double-underscores is if you want Python to name-mangle the variable so it's not (easily) accessible from subclasses. In most cases, this is unnecessary.
Steve -- http://mail.python.org/mailman/listinfo/python-list