Metaclasses broke in 2.2?

Drew Csillag drew_csillag at geocities.com
Tue Aug 14 19:55:48 EDT 2001


On Tue, Aug 14, 2001 at 06:35:01PM -0400, Guido van Rossum wrote:
> Thanks for the feedback, Drew!
> 
> > From: Drew Csillag <drew_csillag at geocities.com>
> 
> > Now to try and figure out why (I've heard about this stuff) my __getattr__
> > function is going into recursive death.
> 
> Probably because it *always* gets called rather than only for missing
> attributes.  The tutorial gives a brief example.

Bingo!  A simple addition of:
try:
    rv = object.__getattr__(self, attr)
    return rv
except AttributeError:
    pass

Did the trick.

Thanks,
Drew
-- 
print(lambda(m,d,y):['Sun','Mon','Tues','Wed','Thurs','Fri','Satur'][(
lambda(m,d,y):(23*m/9+d+4+y/4-y/100+y/400)%7)(m<3and(m,d+y,y-1)or(m,
d+(y-2),y))])(map(int,raw_input('mm/dd/yyyy>').split('/')))+'day'




More information about the Python-list mailing list