[issue4482] 10e667.__format__('+') should return 'inf'
Mark Dickinson
report at bugs.python.org
Wed Apr 22 23:52:18 CEST 2009
Mark Dickinson <dickinsm at gmail.com> added the comment:
> A somewhat related comment about formatting of infs and nans: I think
> that a formatted nan should never include a sign, even when it's
> explicitly asked for.
I'm not so sure about this any more. Sometimes the role of an explicit
sign is to act as a binary operator or visual separator, when there's
something immediately preceding the float being formatted. In this case
one still wants the sign, even for nans.
For example:
>>> "{}{:+}".format(1, float('nan'))
'1+nan'
Also, the implementation is definitely easier this way. :-)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4482>
_______________________________________
More information about the Python-bugs-list
mailing list