[Patches] [ python-Patches-1491866 ] Complex representation
SourceForge.net
noreply at sourceforge.net
Fri May 19 23:27:32 CEST 2006
Patches item #1491866, was opened at 2006-05-19 23:27
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1491866&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Heiko Wundram (hwundram)
Assigned to: Nobody/Anonymous (nobody)
Summary: Complex representation
Initial Comment:
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.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1491866&group_id=5470
More information about the Patches
mailing list