You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 16, 2024. It is now read-only.
It's really really easy to do, but I haven't done it because it would mean importing them automatically even when they aren't used (most of the times, I guess).
Unless I think of a way of doing a conditional import, I don't think it's a good idea to just blindly import the module.
I think float is fine, I don't think you will need excessive precision for ratings.
Anyway you can pass strconstructed={decimal.Decimal} to support it.
This will override the default strconstructed set, so if you want to use also the types that are in there by default you must create the loader/dumper object and do like l.strconstructed.add(decimal.Decimal).
OK, I've made a few tries and made it all work as you have described and as expected according to the documentation for Python's decimal module. I wish generating decimals from floats had a nicer syntax in Python without having to use strings or rounding, but I can see why things are the way they are. Thanks!
Unfortunately non-integer numbers and computers don't get so well together. I still think for your case you don't need that much precision and a float would be fine.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
No description provided.
The text was updated successfully, but these errors were encountered: