Anonymous View
Skip to content

PEP 835: Address Discourse feedback from encukou and tjreedy#4998

Open
till-varoquaux wants to merge 1 commit into
python:mainfrom
till-varoquaux:feature/update-pep835-links
Open

PEP 835: Address Discourse feedback from encukou and tjreedy#4998
till-varoquaux wants to merge 1 commit into
python:mainfrom
till-varoquaux:feature/update-pep835-links

Conversation

@till-varoquaux

Copy link
Copy Markdown
Contributor

This PR incorporates recent feedback from the Discourse discussion for PEP 835. Specifically, it:

  • Clarifies type(None) support
  • Promotes the FORWARDREF_STRUCTURAL mechanism to the Specification section
  • Bumps the deprecation timeline for the compatibility shim to Python 3.21 to align with PEP 387
  • Clarifies the phrasing around stringified annotations under PEP 563

@read-the-docs-community

read-the-docs-community Bot commented Jun 19, 2026

Copy link
Copy Markdown

Documentation build overview

📚 pep-previews | 🛠️ Build #33228511 | 📁 Comparing 5594c7c against latest (f101f94)

  🔍 Preview build  

2 files changed
± pep-0764/index.html
± pep-0835/index.html

Comment thread peps/pep-0835.rst Outdated
supported for any left-hand operand that currently supports the ``|``
operator for making a union.
operator for making a union (including ``type(None)``, which acts as the
canonical equivalent to ``None`` in type hints).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a questionable claim; some parts of typing.py turn None into NoneType but not all typing APIs do.

Also the mention of NoneType is a bit confusing. NoneType is a type like any other, so it inherits __or__ (currently) and __matmul__ (if this PEP is accepted) from type. The more interesting question is what happens to None itself. Currently, it does not in fact support __or__; None | int works, but that's through the latter's __ror__. Therefore, unions of None with a stringified type (None | "int") fail at runtime. You are proposing to make matmul work for None.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Great point. You're right that __matmul__ on NoneType is a special case with potential runtime risks since None relies on __ror__. I've removed the claim and moved the None debate down to a new "Open Issues" section.

Comment thread peps/pep-0835.rst Outdated
pre-existing issue with ``|`` unions, where ``"Foo" | int`` under
``Format.FORWARDREF`` produces ``ForwardRef('Foo | int')`` instead of the
structural ``ForwardRef('Foo') | int``.
structural ``ForwardRef('Foo') | int``. Notably, if ``FORWARDREF_STRUCTURAL``

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems very speculative; there are lots of problems that would need to be solved before this can be entertained.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Apologies, I got carried away! I agree that changing the default evaluation strategy is a massive separate undertaking. I've completely removed the sentence.

@till-varoquaux till-varoquaux force-pushed the feature/update-pep835-links branch from c8917dc to 9d15ddc Compare June 20, 2026 12:55
@till-varoquaux till-varoquaux force-pushed the feature/update-pep835-links branch from 9d15ddc to 5594c7c Compare June 20, 2026 13:00
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