On Fri, 9 Aug 2019 at 19:53, Richard Musil email@example.com wrote:
Joao S. O. Bueno wrote:
yes, just that it should be called dump_as_float and take either a class or a tuple-of-classes
I saw kind of symmetry with the `parse_float` which only accepted one class for having only one class on the output as well. Besides there are probably not many (different) ways how to write a custom type for JSON float in one application. But I cannot see any argument for not having a tuple.
(or maybe just another argument that when set to "True" would work for any object for which isinstance(obj, numbers.Number) is True)
I cannot verify it right now, but if integer (or big int) are derived from `numbers.Number` than it would not work as a distinction for a float. Big int is already handled by standard module correctly.
Maybe we are all just over-discussing a lot of things that could be solved in a straightforward way by allowing decimal.Decimal to be json encoded as numbers by default, with no drawbacks whatsoever. The fact that arbitrarily long integers are encoded with no complaints up to now seems to indicate so. [clip]