Andrew Barnert wrote:
Except that it doesn’t allow that. Using Decimal doesn’t preserve the difference between 1.0000E+3 and 1000.0, or between +12 and 12. Not to mention
but it preserves the exact precision and value, i.e. not a fraction is lost. This alone is worthy considering it as a feature update for me.
People needing to actually preserve 100% of the JSON that gets thrown at them are going to think this does it (because the docs imply it, or some random guy on StackOverflow says so, or it passed the couple of unit tests they thought of), and then deploy code they
Not sure which people you refer to, if you in fact refer to me (because I did not actually noticed requests for that particular feature on stackoverflow) than just stay assured than I am perfectly aware of what you wrote here and I am still convinced that this feature (I am asking for) will be quite useful for me.
And I also believe that others who may potentially want it (and are now dumping decimal.Decimal to string for that) would be perfectly fine with it as well. And those with very specific needs, like me, will be aware of the pitfalls, and will be able to judge in the context of their application, whether it is a benefit or not.
I mean, the OP wants to use this for secure hashes; think about what kind of debugging nightmare that’s likely to lead to. (And I hope nobody actually tries to attack him while he’s debugging the secure hash failures that are just side effects of this bug…)
Forget the secure hash. The OP wants to be able dump the same float he read on the input to the output. If you want do discuss design decisions of why and how I calculate the hash, and why the feature I am asking for is beneficial for my app, feel free to write me on my email and we can take this discussion offline.
The fact that a feature _can_ be misused isn’t a reason to reject it. But the fact that a feature will _almost always_* be misused is a different story.
Being able to dump the float as a float without losing any precision is the feature we are discussing here. The rest is just a background info. How is that going to be misused _almost always_?