super, decorators and gettattribute

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sun Jan 13 08:59:45 CET 2008


On Sat, 12 Jan 2008 14:23:52 -0800, Richard Szopa wrote:

> However, I am very surprised to learn that
> 
> super_object.__getattr__(name)(*args, **kwargs)
> 
> getattr(super_object, name)(*args, **kwargs)
> 
> are not equivalent. This is quite odd, at least when with len()
> and .__len__, str() and .__str__. Do you maybe know what's the
> rationale behind not following that convention by getattr?

I think you are confusing `__getattr__` and `__getattribute__` here! 
`getattr()` maps to `__getattr__()`, it's `__getattribute__` that's
different.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list