Paul Rubin <http://[EMAIL PROTECTED]> writes:
> Chris Gonnerman <[EMAIL PROTECTED]> 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. Note that the quoted article only applies to *writing* attributes. It doesn't say anything about needing accessors to *read* a variable. This encourages me that the convention I use - adopted from Eiffel, where the compiler enforces it - of freeling reading attributes, but providing methods to write them - is a right way todo things. <mike -- Mike Meyer <[EMAIL PROTECTED]> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. -- http://mail.python.org/mailman/listinfo/python-list