[issue12086] Tutorial doesn't discourage name mangling

Ezio Melotti report at bugs.python.org
Mon May 16 11:34:19 CEST 2011


Ezio Melotti <ezio.melotti at gmail.com> added the comment:

I think the main problem here is that they are called "private" and people coming from other languages assume that the double underscore is the Python way to mark variables as private, whereas the appearance of being private is just a side effect of the name mangling.

This part should IMHO focus on the name mangling, explaining what it is and what it's useful for, and mention clearly that this doesn't really make the variable "private", because it can still be accessed through the mangled name.

The section could also mention that the word "private" here doesn't mean the same thing as in other language.

I don't know if the "trust the programmer" philosophy found in Python is explained somewhere in the doc, but if not it could be added to the tutorial or the FAQ.

----------
nosy: +ezio.melotti, rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12086>
_______________________________________


More information about the Python-bugs-list mailing list