New to Python: Features

Andrea Griffini agriff at tin.it
Fri Oct 8 06:48:11 EDT 2004


On Thu, 07 Oct 2004 18:12:38 GMT, Andrew Dalke <adalke at mindspring.com>
wrote:

>Hmm..  The times I needed it I used __getattr__ in old-style
>classes, sometimes as a proxy.  It seems that properties
>should be the appropriate mechanism for new-style classes,
>but I've yet to use them in real code.

I'm curious about the "needed" part. For example I don't remember
ever finding a "real" algorithm bug in C/C++ because of a
const-related error... when the compiler complained about a
const-problem the problem revealed itself in just an incorrectly
declaration of the const specification.
I mean that I don't remember that the const-correctness
specification ever made me discovering someone that was trying
to modify something that shouldn't have been modified.

Does experience shows that this kind of bug is instead frequent
in python ?

Another thing I never found that useful was the "private"
and "protected" eclaration (except for marking taboo things
like copy constructors or assigment for things that can't be
copied or assigned); is that absence something really felt
as a problem in python ? The "private" name thing in python
is of course somehing quite different because solves a problem
that is not present in C++ (in C++ it's ok for a derived
class uses the same name for a member as the base class).

Andrea



More information about the Python-list mailing list