On Aug 30, 6:18 am, Patrick Maupin <[EMAIL PROTECTED]> wrote:
> On Aug 29, 4:24 am, Peter Otten <[EMAIL PROTECTED]> wrote:
>
>
>
> > A minimal example is
>
> > >>> class Complex(complex):
>
> > ... def __radd__(self, other): print "radd"
> > ...>>> 1j + Complex()
>
> > 1j
>
> > versus
>
> > >>>
On Aug 29, 4:24 am, Peter Otten <[EMAIL PROTECTED]> wrote:
> A minimal example is
>
> >>> class Complex(complex):
>
> ... def __radd__(self, other): print "radd"
> ...>>> 1j + Complex()
>
> 1j
>
> versus
>
> >>> class Int(int):
>
> ... def __radd__(self, other): print "radd"
> ...>>> 1 + In
BiDi wrote:
> I have been trying to subclass complex, but I am not able to get the
> right-hand arithmetic operators working.
>
> As shown below, if an object of my subclass 'xcomplex' is added on the
> right of a 'comlex' object, the type returned is 'complex', not
> 'xcomplex'.
>
> I've tried
On Aug 29, 12:17 am, BiDi <[EMAIL PROTECTED]> wrote:
> I have been trying to subclass complex, but I am not able to get the
> right-hand arithmetic operators working.
>
> As shown below, if an object of my subclass 'xcomplex' is added on the
> right of a 'comlex' object, the type returned is 'compl
I have been trying to subclass complex, but I am not able to get the
right-hand arithmetic operators working.
As shown below, if an object of my subclass 'xcomplex' is added on the
right of a 'comlex' object, the type returned is 'complex', not
'xcomplex'.
I've tried subclassing float and it work