diff --git a/pep-0645.rst b/pep-0645.rst index 4c5fe2680..6bd0c0325 100644 --- a/pep-0645.rst +++ b/pep-0645.rst @@ -2,10 +2,11 @@ PEP: 645 Title: Allow writing optional types as ``x?`` Author: Maggie Moss Sponsor: Guido van Rossum -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/typing-sig@python.org/message/E75SPV6DDHLEEFSA5MBN5HUOQWDMUQJ2/ Abstract @@ -13,6 +14,21 @@ Abstract This PEP proposes adding a ``?`` operator for types to allow writing ``int?`` in place of ``Optional[int]``. +PEP Withdrawal +============== + +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 +where it roughly means ``NotRequired[T]``. +Such inconsistency would likely confuse folks coming from TypeScript to Python. + +The above represents the consensus of +`typing-sig `_ +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 @@ -118,7 +134,7 @@ Backwards Compatibility Reference Implementation ======================== -A reference implementation can be found `here `_ [5]. +A reference implementation can be found `here `_. Rejected Ideas ============== @@ -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 =========