[issue5858] Make complex repr and str more like float repr and str
Mark Dickinson
report at bugs.python.org
Mon Apr 27 22:45:09 CEST 2009
New submission from Mark Dickinson <dickinsm at gmail.com>:
In all current versions of Python, the str or repr of a float always
includes *either* an exponent, or a decimal point and at least one digit
after the decimal point.
I propose making the str or repr of a complex number behave in the same
way. That is, instead of
>>> 2+4j
(2+4j)
we'd have:
>>> 2+4j
(2.0+4.0j)
The aims are to make complex representation more consistent with float
representation, retain the visual reminder that the pieces of a complex
number are floats (to me, 2+4j looks like a Gaussian integer rather than
a complex number), simplify the implementation a little, and remove the
ugliness where floats switch from normal to exponential notation at
1e11, but complex numbers switch at 1e12.
See
http://mail.python.org/pipermail/python-dev/2009-April/089030.html
for some additional discussion.
----------
assignee: marketdickinson
components: Interpreter Core
messages: 86692
nosy: eric.smith, marketdickinson
priority: high
severity: normal
stage: needs patch
status: open
title: Make complex repr and str more like float repr and str
type: feature request
versions: Python 3.1
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5858>
_______________________________________
More information about the Python-bugs-list
mailing list