Skip to content

bpo-38994: Implement __class_getitem__ for PathLike #17498

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
Dec 8, 2019

Conversation

isidentical
Copy link
Member

@isidentical isidentical commented Dec 7, 2019

Copy link
Contributor

@asvetlov asvetlov left a comment

Choose a reason for hiding this comment

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

Adding __class_getitem__ to os.PathLike only is not enough for using, e.g. pathlib.Path[str] in runtime.

pathlib.PurePath should be modified in this way as well.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@isidentical
Copy link
Member Author

@asvetlov I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@asvetlov: please review the changes made to this pull request.

@bedevere-bot bedevere-bot requested a review from asvetlov December 8, 2019 18:43
@asvetlov
Copy link
Contributor

asvetlov commented Dec 8, 2019

Awesome, thanks!

@@ -0,0 +1 @@
Implement ``__class_getitem__`` for ``os.PathLike``, ``pathlib.Path``
Copy link
Member

Choose a reason for hiding this comment

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

This news item is slightly misleading as the change was made to pathlib.PurePath, not pathlib.Path.

Copy link
Member

Choose a reason for hiding this comment

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

And @isidentical forgot to give himself credit for the change. :)

@brettcannon
Copy link
Member

Any reason not to document this?

@isidentical
Copy link
Member Author

isidentical commented Dec 9, 2019

It is kind of irrelevant but I wrote a simple script to analyze typeshed and I think i found other classes with missing class getitems. Should I open an issue per class or just open one and fix all of them in one PR (I can tweak the comment change @brettcannon said in that PR). It is like 6-7 lines per class so i dont think it would make review harder.

@brettcannon
Copy link
Member

@isidentical individual is always easier to review, but if it's too much work you can try doing it in a single PR.

@asvetlov
Copy link
Contributor

@isidentical would you make a follow-up PR for fixing @brettcannon notes?

@isidentical
Copy link
Member Author

isidentical commented Dec 10, 2019 via email

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.

6 participants