Skip to content

pathlib.Path.open: bring on the overloads #4407

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

Merged
merged 2 commits into from
Aug 22, 2020

Conversation

hauntsaninja
Copy link
Collaborator

No description provided.

@Akuli
Copy link
Collaborator

Akuli commented Aug 7, 2020

Why are there 4 different specific binary modes (OpenBinaryModeUpdating, ...Writing, ...Reading, union of all the others), but only one text mode?

@JelleZijlstra
Copy link
Member

@Akuli text mode returns the same concrete type regardless of the precise mode, while binary mode returns different types.

) -> BinaryIO: ...
# Fallback if mode is not specified
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure this is right in Python 2; our stub for builtins currently always return BinaryIO from Python 2's open.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, check_consistent has just conditioned me to copy-paste. One day we'll be free.

@hauntsaninja
Copy link
Collaborator Author

gentle bump!

@JelleZijlstra JelleZijlstra merged commit 723fcb3 into python:master Aug 22, 2020
@hauntsaninja hauntsaninja deleted the path branch August 22, 2020 03:43
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.

3 participants