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

Mark Dickinson report at bugs.python.org
Tue Apr 28 11:39:39 CEST 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

Two things that haven't come up so far:

(1) What about parentheses? The current complex repr and str have
parentheses in them, for reasons that I still don't really understand.

I'd suggest leaving them out altogether;  except that I have
the impression (perhaps wrongly) that an empty type code is
supposed to correspond to str.  And given that I don't understand
why the parens were in there in the first place, I'm probably
not a good person to judge whether they should stay in a
formatted complex number.

(2) What about zeros?  The current repr and str leave out the real
part (and the enclosing parens) if it's equal to zero.  Should
format do the same?  I'd say not, except possibly again in the
case where there's no type code.

----------

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


More information about the Python-bugs-list mailing list