PEP 645: Mark as Withdrawn (and as Standards Track) (#2529)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
This commit is contained in:
parent
0140226753
commit
cf75fc46d0
24
pep-0645.rst
24
pep-0645.rst
|
@ -2,10 +2,11 @@ PEP: 645
|
|||
Title: Allow writing optional types as ``x?``
|
||||
Author: Maggie Moss <maggiebmoss@gmail.com>
|
||||
Sponsor: Guido van Rossum <guido@python.org>
|
||||
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 <https://mail.python.org/archives/list/typing-sig@python.org/>`_
|
||||
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 <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
|
||||
==============
|
||||
|
@ -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
|
||||
=========
|
||||
|
|
Loading…
Reference in New Issue