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

Built-in generic now work without limitations #1068

Merged
merged 4 commits into from
Feb 12, 2022

Conversation

srittau
Copy link
Collaborator

@srittau srittau commented Feb 11, 2022

Closes: #1067


In these cases, the appropriate types from ``typing`` must be used.
PEP 585 [#pep585]_ built-in generics are supported and should be used instead
of the corresponding types from ``typing``.

Using imports from ``collections.abc`` instead of ``typing`` is
generally possible and recommended.
Copy link
Member

Choose a reason for hiding this comment

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

Can we drop the "generally" here too? I don't think there are any exceptions left.

Also, it would be good to have some examples in this section. We can list bad examples like "from typing import Sequence" and "List[int]" and good ones like "from collections.abc import Sequence" and "list[int]".

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

@srittau srittau Feb 11, 2022

Choose a reason for hiding this comment

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

I added a few examples, although I only used positive examples as in other examples in this section.

Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

One nit

Co-authored-by: Jelle Zijlstra <[email protected]>
@JelleZijlstra JelleZijlstra merged commit e982c96 into python:master Feb 12, 2022
@srittau srittau deleted the pep-585 branch February 13, 2022 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update the status of built-in generics usage in type stubs
4 participants