bpo-40801: Add operator.as_float by mdickinson · Pull Request #20481 · python/cpython
Conversation
This PR exposes PyFloat_AsDouble to Python level in the form operator.as_float. This provides a way for Python code to emulate the implicit float conversions that Python itself does at C level.
| pass | ||
|
|
||
| if bad_type: | ||
| raise TypeError(f"must be real number, not {obj.__class__.__name__}") |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean real number in the math sense? Or do you mean it as instead of a string representation of a number?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the mathematical sense. But this wording isn't new to this PR; it's copied from here.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. That makes sense. :-)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters