Re: [Python-Dev] nonstandard behavior of reflected functions

2009-10-18 Thread Nick Coghlan
Ehsan Amiri wrote: > I see the same behaviour, moreover when I change class Quantity to a > classic class (removing '(object)'), it works as expected. (i.e. > Quanitity.__add__() is called after the fourth print. I run Python 2.6.2 > on Vista. Darren found the explanation further down the page he

Re: [Python-Dev] nonstandard behavior of reflected functions

2009-10-18 Thread Ehsan Amiri
I see the same behaviour, moreover when I change class Quantity to a classic class (removing '(object)'), it works as expected. (i.e. Quanitity.__add__() is called after the fourth print. I run Python 2.6.2 on Vista. On Sun, Oct 18, 2009 at 7:50 AM, Darren Dale wrote: > According to http://

Re: [Python-Dev] nonstandard behavior of reflected functions

2009-10-18 Thread Darren Dale
On Sun, Oct 18, 2009 at 10:50 AM, Darren Dale wrote: > According to http://docs.python.org/reference/datamodel.html , the > reflected operands functions like __radd__ "are only called if the > left operand does not support the corresponding operation and the > operands are of different types. [3]

[Python-Dev] nonstandard behavior of reflected functions

2009-10-18 Thread Darren Dale
According to http://docs.python.org/reference/datamodel.html , the reflected operands functions like __radd__ "are only called if the left operand does not support the corresponding operation and the operands are of different types. [3] For instance, to evaluate the expression x - y, where y is an