Ethan Kennerly a écrit : > Thanks for the help! Using the "class name (object)" syntax fixed my > problem. > (snip) > > I am having to unteach myself some of the defensive programming techniques > in C++, such as using name mangling to ensure privacy, when privacy is not > the most important criterion. For prototyping, starting public and going > "private" later is more efficient when refactoring.
(just a clarification for Python new-comers reading this thread) This is the usual way to handle public (non-callable) attributes - starting with a plain attribute, then refactoring to a property if and when needed. But this doesn't imply you should only use 'public' attributes. While it has no real notion of privacy (ie: no language-enforced access restriction), Python has a well-established convention for marking attributes and methods as "protected" : prefixing the name with a *single* underscore. This won't invoke any name-mangling nor prevent direct access to the attribute, but warn anyone that this attribute is implementation, IOW "don't mess with it or you're on your own". -- http://mail.python.org/mailman/listinfo/python-list