[docs] [issue19871] json module won't parse a float that starts with a decimal point

Mark Dickinson report at bugs.python.org
Tue Dec 3 13:32:59 CET 2013

Mark Dickinson added the comment:

In context, the doc is correct:

parse_float, if specified, will be called with the string of every JSON float to be decoded. By default, this is equivalent to float(num_str).

IIUC, parse_float only comes into play once the JSON source has already been tokenized, and the tokenization stage has already rejected things like '.5' by that point.  (The point of parse_float is that you can choose to turn numeric strings into decimal.Decimal instances instead of floats if you so wish.)

I agree it could use clarification.


Python tracker <report at bugs.python.org>

More information about the docs mailing list