bockman at virgilio.it
Fri Aug 27 20:46:59 CEST 2004
On Fri, 27 Aug 2004 16:55:28 +0000, Jeremy Bowers wrote:
> In Python, there isn't much of an idea of "Private"; Python's philosophy
> is "We're all consenting adults here." Thus, there isn't much of an idea
> of "friends" either. In Java terminology, on a technical level
> everybody is already friends with everybody else already.
My own 'rule of thumb' in accessing from outside to the attributes
of a Python class is "read attributes directly, but change them only via
methods". In other words, I treat all attributes in a class as 'readonly'.
This allow me to cut off amletic questions like "shall this be public of
private?", only to change it later on. The rule is so effective that I
tend to use it also in languages that allow public/protected/private
distinctions, like C++ and Java.
More information about the Python-list