On Tue, Jun 16, 2020 at 11:55 PM Christopher Barker <python...@gmail.com>
wrote:

> Well, maybe not "Decimal", but it IS, in fact decimal -- i.e. base 10 --
> it can only exactly represent  values that can be exactly represented in
> base 10.
> Which is why, performance aside, it would be better if a JSON number
> mapped to a Python Decimal, rather than a float.Which I'd still like to see
> happen, at least optionally.
>

I strongly agree.  simplejson has `use_decimal=True`, which is
straightforward.  The standard library would require users painfully define
their own subclasses of JSONEncoder and JSONDecoder that have the desired
Decimal behavior (passing in the `cls=` argument to use the custom
classes).  It's doable, but it should *just work* with a switch instead.

-- 
The dead increasingly dominate and strangle both the living and the
not-yet born.  Vampiric capital and undead corporate persons abuse
the lives and control the thoughts of homo faber. Ideas, once born,
become abortifacients against new conceptions.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/ILNTYE7CY7HX4GW26SH4NTA2ORSA5DMO/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to