On 2017-06-06, Peter Otten <[email protected]> wrote:
> ...but not the empty string:
>
>>>> float("")
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ValueError: could not convert string to float:
>
> Maybe there were some backward compatibility concerns that I lack the
> fantasy to imagine.
It's a little odd, PyFloat_FromString just calls:
PyErr_Format(PyExc_ValueError,
"could not convert string to float: %R", v);
which should be appending the repr() of the argument to the error
message, and there's no code I can see anywhere that would be
special-casing the empty string and avoiding inserting "''".
--
https://mail.python.org/mailman/listinfo/python-list