PEP 637: Removed Ellipsis rule -- '...' is just an expression already (#1623)

This commit is contained in:
Stefano Borini 2020-09-26 17:38:24 +01:00 committed by GitHub
parent 9f611691c0
commit ed5f3b191f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

View File

@ -413,12 +413,7 @@ The following old semantics are preserved:
This may open up the possibility to accept the same syntax for general function This may open up the possibility to accept the same syntax for general function
calls, but this is not part of this recommendation. calls, but this is not part of this recommendation.
11. Keyword arguments must allow Ellipsis:: 11. Keyword arguments allow for default values::
obj[..., spam=..., eggs=2]
# calls type(obj).__getitem__(obj, Ellipsis, spam=Ellipsis, eggs=2)
12. Keyword arguments allow for default values::
# Given type(obj).__getitem__(obj, index, spam=True, eggs=2) # Given type(obj).__getitem__(obj, index, spam=True, eggs=2)
obj[3] # Valid. index = 3, spam = True, eggs = 2 obj[3] # Valid. index = 3, spam = True, eggs = 2
@ -426,7 +421,7 @@ The following old semantics are preserved:
obj[spam=False] # Valid. index = (), spam = False, eggs = 2 obj[spam=False] # Valid. index = (), spam = False, eggs = 2
obj[] # Invalid. obj[] # Invalid.
13. The same semantics given above must be extended to ``__class__getitem__``: 12. The same semantics given above must be extended to ``__class__getitem__``:
Since PEP 560, type hints are dispatched so that for ``x[y]``, if no Since PEP 560, type hints are dispatched so that for ``x[y]``, if no
``__getitem__`` method is found, and ``x`` is a type (class) object, ``__getitem__`` method is found, and ``x`` is a type (class) object,
and ``x`` has a class method ``__class_getitem__``, that method is and ``x`` has a class method ``__class_getitem__``, that method is