Skip Montanaro wrote: > Are float("inf") and float("nan") supported everywhere?
nope. >>> float("inf") Traceback (most recent call last): File "<stdin>", line 1, in ? ValueError: invalid literal for float(): inf >>> float("nan") Traceback (most recent call last): File "<stdin>", line 1, in ? ValueError: invalid literal for float(): nan >>> 1e10000 1.#INF >>> float("1.#INF") Traceback (most recent call last): File "<stdin>", line 1, in ? ValueError: invalid literal for float(): 1.#INF > As a starting point can it be agreed on whether they should be supported? that would be nice. > In either case, we should then know how to fix marshal.loads (and probably > pickle.loads). pickle doesn't have the INF=>1.0 bug: >>> import pickle >>> pickle.loads(pickle.dumps(1e10000)) ... ValueError: invalid literal for float(): 1.#INF >>> import cPickle >>> cPickle.loads(cPickle.dumps(1e10000)) ... ValueError: could not convert string to float >>> import marshal >>> marshal.loads(marshal.dumps(1e10000)) 1.0 </F> _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com