Bugs item #1732212, was opened at 2007-06-06 16:50
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1732212&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Pete Shinners (shredwheat)
Assigned to: Nobody/Anonymous (nobody)
Summary: repr of 'nan' floats not parseable

Initial Comment:
The repr of float('nan') is not parsable as a literal in Python.

If the repr of 'nan' became "float('nan')" then the result could be evaluated 
to produce the same results.

A better possible solution would be to add "nan" and "inf" as attributes on 
float. These would be accessed as "float.nan" and "float.inf". This doesn't 
allow for "-inf" as cleanly, but "float.ninf" could be acceptable. Repr would 
be changed to return these.

A patch can be provided if the solution sounds resonable.



>>> repr((1.0, 2.0, 3.0))
'(1.0, 2.0, 3.0)'
>>> eval(_)
(1.0, 2.0, 3.0)

>>> repr((1.0, float('nan'), 3.0))
'(1.0, nan, 3.0)'
>>> eval(_)
NameError: name 'nan' is not defined


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1732212&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to