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

builtins.pow: improve annotation #3647

Merged
merged 2 commits into from
Jan 24, 2020
Merged

builtins.pow: improve annotation #3647

merged 2 commits into from
Jan 24, 2020

Conversation

hauntsaninja
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Thanks, one comment.

def pow(__x: float, __y: float, __z: float) -> float: ...
if sys.version_info >= (3, 8):
@overload
def pow(base: int, exp: int, mod: Optional[int] = ...) -> int: ...
Copy link
Collaborator

Choose a reason for hiding this comment

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

Needs to return Any per previous comment. E.g. pow(3, -1) returns a float. It makes sense to use another overload for the case where mod is an int, since then only int can be returned. (Affects both branches.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh of course. Sorry about that, total mental lapse

@hauntsaninja hauntsaninja requested a review from srittau January 24, 2020 06:11
@srittau srittau merged commit ed95668 into python:master Jan 24, 2020
@hauntsaninja hauntsaninja deleted the pow branch January 24, 2020 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants