Will python never intend to support private, protected and public?

Paul Rubin http
Wed Sep 28 09:32:13 EDT 2005


Chris Gonnerman <chris.gonnerman at newcenturycomputers.net> writes:
> -- Make it easy to do right.
> 
> What you are promoting is the first philosophy: Tie the programmer's
> hands so he can't do wrong.  Python for the most part follows the
> second philosophy, making writing good code so easy that the coder
> is rarely tempted to commit any evil.

Unless you can show that all Python code is bug-free, you've got to
consider that there might be something to this private and protected
stuff.  See for example this message:

  http://groups.google.com/group/sci.crypt/msg/59516419dc874e63?dmode=source

Name mangling is a poor substitute for private variables.  If you want
to be able to share private variables with other classes under certain
circumstances, it's better to use something like C++'s "friend"
declaration, where you can export the variables to a specific other class.



More information about the Python-list mailing list