Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-40801: Add operator.as_float #20481

Closed
wants to merge 3 commits into from

Conversation

mdickinson
Copy link
Member

@mdickinson mdickinson commented May 28, 2020

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.

https://bugs.python.org/issue40801

Doc/library/operator.rst Outdated Show resolved Hide resolved
Lib/operator.py Outdated Show resolved Hide resolved
Lib/operator.py Outdated Show resolved Hide resolved
@mdickinson mdickinson added the type-feature A feature request or enhancement label May 28, 2020
pass

if bad_type:
raise TypeError(f"must be real number, not {obj.__class__.__name__}")
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. That makes sense. :-)

@mdickinson mdickinson marked this pull request as draft May 29, 2020 09:59
@mdickinson
Copy link
Member Author

Converted this PR to draft; the feature is still under discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting core review type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants