Status of PEP 645? (Allow writing optional types as x?)

The typing-related PEP 645 - which introduces the syntax `T?` to mean `Optional[T]` - only has a single substantial related commit in the PEPs repo - the commit introducing the PEP (in Nov 2020) - and no discussions thread that I can find (on typing-sig or elsewhere).
I'm personally quite interested in the potential capability to quickly signify `Optional[T]` since it is something I do a lot.
What is the status of this PEP? Deferred for now? Withdrawn in favor of `T|None` syntax?† Something else?

I no longer support this. T|None is a fine way to write optional types, and doesn't require new syntax.
We should also consider that in e.g. TypeScript, x? means something quite different than T|None; there, x? refers to allowing the absence of a parameter or field, not its type (more like NotRequired in your PEP 655). This could be confusing for users who use both languages.
On Tue, Mar 29, 2022 at 10:26 PM David Foster davidfstr@gmail.com wrote:
The typing-related PEP 645 - which introduces the syntax `T?` to mean `Optional[T]` - only has a single substantial related commit in the PEPs repo - the commit introducing the PEP (in Nov 2020) - and no discussions thread that I can find (on typing-sig or elsewhere).
I'm personally quite interested in the potential capability to quickly signify `Optional[T]` since it is something I do a lot.
What is the status of this PEP? Deferred for now? Withdrawn in favor of `T|None` syntax?† Something else?
-- David Foster | Seattle, WA, USA Contributor to TypedDict, mypy, and Python's typing system
† Through the grapevine I've been inferring that folks have been gravitating toward the slightly-shorter `T|None` syntax to spell `Optional[T]` in the meantime, and I even mention that spelling in my own PEP 655 (Required[]) [1]

I can't report on the state of the PEP. I just would like to present another argument to not do this: `Optional`, in the first place, is a somewhat confusing misnomer: "`Optional` arguments of a function" are something different than "optional arguments of a function". In dictionary fields, an `Optional?` field is not "optional" either (just the value may be `None`). I think it is much more declarative to write `T | None` instead of `Optional[T]`. I think, the `T?` syntax would just be another way to stick to the idea of avoiding to write the more clear `T | None`.
Am 30.03.2022 07:25 schrieb David Foster:
The typing-related PEP 645 - which introduces the syntax `T?` to mean `Optional[T]` - only has a single substantial related commit in the PEPs repo - the commit introducing the PEP (in Nov 2020) - and no discussions thread that I can find (on typing-sig or elsewhere).
I'm personally quite interested in the potential capability to quickly signify `Optional[T]` since it is something I do a lot.
What is the status of this PEP? Deferred for now? Withdrawn in favor of `T|None` syntax?† Something else?

The original author (Maggie Moss) isn't working on this anymore. Pyre is no longer in favor of adding new syntax for this because of concerns that Guido mentioned (`int | None` already exists, etc.).
David: If you or others feel strongly about this, however, feel free to commandeer the PEP.

It sounds then like this PEP is Withdrawn:
* Introducing new syntax/grammar has a high barrier to overcome, and the benefits of adding `x?` do not meet that bar (in the opinion of the Author & Sponsor) when `x|None` is short enough to write and more clear * Using `x?` to mean `x|None` is inconsistent with TypeScript where there it roughly means `NotRequired[x]`. Such inconsistency would likely confuse folks coming from TypeScript, a very popular language.
Perhaps it would be useful to mark the PEP as Withdrawn, and provide a short paragraph at the top of the PEP summarizing why?
Since I pretty much just wrote that paragraph with the bulleted list above 🙃, I'd be happy to make the edits myself if there are no objections.

I did draft a PR to withdraw PEP 645: https://github.com/python/peps/pull/2529
Best,
participants (4)
-
David Foster
-
Guido van Rossum
-
j.scholbach@posteo.de
-
Pradeep Kumar Srinivasan