[Steven D'Aprano <st...@pearwood.info>] > ... > (To be honest, I was surprised to learn that the context precision is > ignored when creating a Decimal from a string. I still find it a bit odd > that if I set the precision to 3, I can still create a Decimal with > twelve digits.)
You're not alone ;-) In the original IEEE 754 standard, string-to-float was "an operation" like any other, required to honor the current rounding mode (and all the rest of the usual rules). It still is, in later revisions. But they don't cater to a single data type supporting multiple precisions - they have a distinct data type for each distinct precision. I suggested following the standards' rules (the constructor works the same way as everything else - it rounds) for Python's module too, but Mike Cowlishaw (the decimal spec's primary driver) overruled me on that. I was really annoyed at the time - but in practice like it fine. Nevertheless, it still feels more ike "a wart" than "a feature" ;-) _______________________________________________ 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/WYLSYO4ZQULRRVT2TD2PYUUXIYB22LGL/ Code of Conduct: http://python.org/psf/codeofconduct/