Sylvain Ferriol wrote: > can you explain to me what happened: > > class toto(object): > eq = float.__eq__ > > t = toto() > > getattr(t,'eq') > TypeError: descriptor '__eq__' for 'float' objects doesn't apply to > 'toto' object
float.__eq__ is probably implemented in C and its operation will make sense only for instances of float or subclasses of float. Try >>> class Toto(float): ... eq = float.__eq__ ... >>> Toto().eq(42) False Peter -- http://mail.python.org/mailman/listinfo/python-list