Message81571
| Author |
ajaksu2 |
| Recipients |
ajaksu2, gumtree, mark.dickinson |
| Date |
2009年02月10日.18:12:31 |
| SpamBayes Score |
0.028856765 |
| Marked as misclassified |
No |
| Message-id |
<1234289553.14.0.889357209954.issue3734@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Confirmed in trunk. Here's a copy-n-past'able testcase:
class xcomplex( complex ):
def __new__(cls,*args,**kwargs):
return complex.__new__(cls,*args,**kwargs)
def __coerce__(self,other):
t = complex.__coerce__(self,other)
try:
return (self,xcomplex(t[1]))
except TypeError:
return t
def __add__(self,x):
return xcomplex( complex.__add__(self,x) )
def __radd__(self,x):
return xcomplex( complex.__radd__(self,x) )
class xfloat(float):
def __new__(cls,*args,**kwargs):
return float.__new__(cls,*args,**kwargs)
def __coerce__(self,other):
t = float.__coerce__(self,other)
try:
return (self,float(t[1]))
except TypeError:
return t
def __add__(self,x):
return xfloat( float.__add__(self,x) )
def __radd__(self,x):
return xfloat( float.__radd__(self,x) )
z = 1j
xz = xcomplex(1j)
f = 1.0
xf = xfloat(1.0)
print type(z + xz)
print type(f + xf) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2009年02月10日 18:12:33 | ajaksu2 | set | recipients:
+ ajaksu2, mark.dickinson, gumtree |
| 2009年02月10日 18:12:33 | ajaksu2 | set | messageid: <1234289553.14.0.889357209954.issue3734@psf.upfronthosting.co.za> |
| 2009年02月10日 18:12:32 | ajaksu2 | link | issue3734 messages |
| 2009年02月10日 18:12:31 | ajaksu2 | create |
|