[issue1588] str.format() wrongly formats complex() numbers (Py30a2)

Eric Smith report at bugs.python.org
Mon Apr 27 11:10:44 CEST 2009


Eric Smith <eric at trueblade.com> added the comment:

I agree this is a feature request. It comes down to:

What should the format specifier mini-language for complex numbers look
like?

Should it look like the existing mini-language for floats, but have the
format specified twice, with some sort of delimiter? Or just specified
once, and use that for both parts?

I'm sure python-ideas could argue over it for ages, but I don't see any
outcome that's much of an improvement over the suggested:
"{0.real:.5f}{0.imag:+.5f}j".format(complex(1, -2/3))

----------
type: behavior -> feature request
versions: +Python 2.7 -Python 3.0

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1588>
_______________________________________


More information about the Python-bugs-list mailing list