Bugs item #1732212, was opened at 2007-06-06 18:50 Message generated for change (Comment added) made by loewis 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 ---------------------------------------------------------------------- >Comment By: Martin v. Löwis (loewis) Date: 2007-06-06 20:40 Message: Logged In: YES user_id=21627 Originator: NO Please discuss this on python-dev. ---------------------------------------------------------------------- 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