Skip to content

PEP 544: Fix error in "Type[] and class objects vs protocols" section #3561

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

Closed
wants to merge 1 commit into from

Conversation

rodrigodesalvobraz
Copy link

@rodrigodesalvobraz rodrigodesalvobraz commented Dec 2, 2023

a: ProtoA = C  # Type check error, signatures don't match!
b: ProtoB = C  # OK

should be

a: Type[ProtoA] = C  # Type check error, signatures don't match!
b: Type[ProtoB] = C  # OK

because C is a candidate subtype of ProtoA and a subtype of ProtoB

  • Change is either:
    • To a Draft PEP
    • To an Accepted or Final PEP, with Steering Council approval
    • To fix an editorial issue (markup, typo, link, header, etc)
  • PR title prefixed with PEP number (e.g. PEP 123: Summary of changes)

📚 Documentation preview 📚: https://pep-previews--3561.org.readthedocs.build/

…544.rst

a: ProtoB = C
should be
a: Type[ProtoB] = C
because C is a subtype of ProtoB
@ghost
Copy link

ghost commented Dec 2, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

@JelleZijlstra
Copy link
Member

This example is correct; see #2332 for the most thorough discussion.

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