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

PEP 645: Mark as Withdrawn (and as Standards Track) #2529

Merged
merged 8 commits into from
Apr 15, 2022
24 changes: 19 additions & 5 deletions pep-0645.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,33 @@ PEP: 645
Title: Allow writing optional types as ``x?``
Author: Maggie Moss <[email protected]>
Sponsor: Guido van Rossum <[email protected]>
Status: Draft
Type: Process
Status: Withdrawn
Type: Standards Track
Content-Type: text/x-rst
Created: 25-Aug-2020
Resolution: https://mail.python.org/archives/list/[email protected]/message/E75SPV6DDHLEEFSA5MBN5HUOQWDMUQJ2/


Abstract
========
This PEP proposes adding a ``?`` operator for types to allow writing ``int?`` in place of ``Optional[int]``.


PEP Withdrawal
==============

JelleZijlstra marked this conversation as resolved.
Show resolved Hide resolved
The notation ``T|None`` introduced by :pep:`604` to write ``Optional[T]`` is a
fine alternative to ``T?`` and does not require new syntax.

Using ``T?`` to mean ``T|None`` is also inconsistent with TypeScript
(a very popular language) where it roughly means ``NotRequired[T]``.
davidfstr marked this conversation as resolved.
Show resolved Hide resolved
Such inconsistency would likely confuse folks coming from TypeScript to Python.

The above represents the consensus of
`typing-sig <https://mail.python.org/archives/list/[email protected]/>`_
and the sponsor of this PEP.


Motivation
==========
Types have become a valuable and powerful part of the Python language. However, many type annotations are verbose and add
Expand Down Expand Up @@ -118,7 +134,7 @@ Backwards Compatibility
Reference Implementation
========================

A reference implementation can be found `here <https://github.com/python/cpython/compare/master...MaggieMoss:new-optional-syntax-postfix>`_ [5].
A reference implementation can be found `here <https://github.com/python/cpython/compare/main...MaggieMoss:new-optional-syntax-postfix>`_.

Rejected Ideas
==============
Expand All @@ -136,8 +152,6 @@ References
(https://gist.github.com/MaggieMoss/fd8dfe002b2702fae243dbf81a62624e)
.. [3] Github Issue Discussion of Optional syntax
(https://github.com/python/typing/issues/429)
.. [5] Reference Implementation
(https://github.com/python/cpython/compare/master...MaggieMoss:new-optional-syntax-postfix)

Copyright
=========
Expand Down