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

Mark Dickinson report at bugs.python.org
Mon Apr 27 18:51:52 CEST 2009


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

> How about this:

> - we have a single specifier with the same format as floats
> - we force the sign on the imaginary part to be '+', no
>    matter what was specified
> - we add a 'j' after the imaginary part

This sounds good to me.  I assume a '+' would still affect
the sign of the real part?

> - we ignore any width specified (and therefor any alignment
>    and padding)

I don't see any problem with dealing with width, alignment
and padding with a user-specified fill character;  I think we
should keep these if possible.  It's just zero padding where
it's not clear what should happen.

For the bits that are disabled (e.g., zero padding), should
there be a ValueError raised, or do those bits just get
silently ignored?

----------

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


More information about the Python-bugs-list mailing list