Mark Dickinson added the comment:
A couple of points against this change:
1. If repr(float('inf')) became "float('inf')", we'd lose the invariant that
float(repr(x)) recovers x for all floats (including infinities and nans).
2. Since repr and str are currently identical for floats, this change would
either end up modifying str too, or making str and repr different; neither
option is particularly palatable. While I can see a case for the repr
returning something eval-able, I think the str of an infinity should remain as
"inf" or "-inf".
3. For consistency, you'd need to change the complex and Decimal outputs, too.
4. The current output of repr and str is directly parseable by most other
languages.
So -1 from me.
(Changing type to 'enhancement'; we use 'behaviour' for bugs, and this isn't
one. :-)
----------
type: behavior -> enhancement
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue22951>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com