[Tutor] Very wierd namespace problem

Tycho Andersen tycho at tycho.ws
Sat Jul 18 18:18:25 CEST 2009


On Fri, Jul 17, 2009 at 12:02 PM, Kent Johnson<kent37 at tds.net> wrote:
> Names beginning with __ are 'mangled' to make them sort of secret.
> This is a feature:
> http://docs.python.org/reference/expressions.html#index-889

Just to add a bit, this interpreter session may be enlightening:

>>> class a:
...     def __method():
...             pass
...
>>> dir(a())
['__doc__', '__module__', '_a__method']

\t


More information about the Tutor mailing list