New submission from jaebae17:

The help page for the built-in repr() states ''' For many types, this function 
makes an attempt to return a string that would yield an object with the same 
value when passed to eval()...'''

This holds true for non-inf/nan values of float():
>>> eval(repr(float('0.0')))
0.0

But for inf, -inf, and nan it does not:
>>> eval(repr(float('inf')))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1, in <module>
NameError: name 'inf' is not defined

Expected return from repr(float('inf')) was "float('inf')", but perhaps 'inf' 
response has too much history at this point to be changed.

----------
messages: 231724
nosy: jaebae17
priority: normal
severity: normal
status: open
title: unexpected return from float.__repr__() for inf, -inf, nan
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22951>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to