classes (was Re: Same again please for OOP)

Emile van Sebille emile at
Mon Dec 25 19:54:54 CET 2000

Just to throw in my $.02.

If not for __getattr__ and __setattr__, I probably wouldn't
have continued with Python.  I'm not sure I would have found
anything better, so I may have come back anyway, but these
two automagic functions allowed me to write a proof of
concept model in about two days, when in other environments
I had nothing worthwhile after two weeks.


Emile van Sebille
emile at

"Moshe Zadka" <moshez at> wrote in message
news:mailman.977739488.28224.python-list at
> On Mon, 25 Dec 2000, "Alex Martelli" <aleaxit at>
> > Other languages may well-nigh force one to frame
> > things up in terms of accessors/mutators, but that's an
> > issue with *those* languages -- not one we should copy
> > in Python, which lets us be more direct and simple.
> You'd be right, if Python's __getattr__ would be better.
There are a couple
> of PEPs on the issue (Barry's, which AFAIK was rejected,
and Paul's), just
> to show many people in the Python's development team are
dissatisfied. If
> you've ever written a __getattr__ method, you probably
know what a pain it
> is. In contrast to the rest of Python, where I can code up
200-line application
> with something on the order of 2 (easily found) bugs,
__getattr__ always
> seems to lead to twisted recursion bugs, and all kinds of
> *Particularily* if you also mix in __setattr__.
> I've learned the hard way not to write __getattr__
methods. Currently, none
> of my code contains them. True gurus, like Gordon
McMillan, can use __getattr__
> (e.g., in, to get lazy evaluation of
attributes, but I tend to
> fear those things.
> The "computed attributes" interface needs to be improved
befroe Python can
> be said to be not one of *those* languages.
> --
> Moshe Zadka <sig at>
> This is a signature anti-virus.
> Please stop the spread of signature viruses!

More information about the Python-list mailing list