Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Closed
rodrigodesalvobraz wants to merge 1 commit into
python:mainpython/peps:mainfrom
rodrigodesalvobraz:mainrodrigodesalvobraz/peps:mainCopy head branch name to clipboard
Closed

PEP 544: Fix error in "Type[] and class objects vs protocols" section#3561
rodrigodesalvobraz wants to merge 1 commit into
python:mainpython/peps:mainfrom
rodrigodesalvobraz:mainrodrigodesalvobraz/peps:mainCopy head branch name to clipboard

Conversation

@rodrigodesalvobraz

@rodrigodesalvobraz rodrigodesalvobraz commented Dec 2, 2023

Copy link
Copy Markdown
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

ghost commented Dec 2, 2023

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

@JelleZijlstra

Copy link
Copy Markdown
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.