Message50297
As per request on c.l.p:
http://groups.google.de/group/comp.lang.python/browse_thread/thread/26c93fefefd3a100/bf1924ce28fac1ac?hl=de#bf1924ce28fac1ac
I've implemented a small patch to change the output of
repr(x) for complex variables, so that complex(repr(x))
works for any complex x. This changes the output of
repr(x) to
'<r>+<i>j'
without brackets, but leaves the string output
untouched. This change of behaviour would be in line
with int(repr(x)) and float(repr(x)) being defined for
any int or float x, repectively.
I don't know whether this patch is sensible, and
whether it breaks any current code, because (for example)
eval("5*%r" % (1+2j,))
won't work properly anymore, or whether it'd be more
sensible to change the complex constructor to also
accept a bracketed expression. I'll attach a patch to
do the latter later. |
|
Date |
User |
Action |
Args |
2007-08-23 15:48:58 | admin | link | issue1491866 messages |
2007-08-23 15:48:58 | admin | create | |
|