@@ -290,7 +290,7 @@ example use case 1, where a slice is accepted.
290
290
291
291
The successful implementation of this PEP will result in the following behavior:
292
292
293
- 1. An empty subscript is still illegal, regardless of context::
293
+ 1. An empty subscript is still illegal, regardless of context (see Rejected Ideas) ::
294
294
295
295
obj[] # SyntaxError
296
296
@@ -394,7 +394,7 @@ The successful implementation of this PEP will result in the following behavior:
394
394
The following notation equivalence should be honored::
395
395
396
396
obj[*()]
397
- # Error. Equivalent to obj[]
397
+ # Equivalent to obj[() ]
398
398
399
399
obj[*(), foo=3]
400
400
# Equivalent to obj[foo=3]
@@ -414,7 +414,7 @@ The successful implementation of this PEP will result in the following behavior:
414
414
The following notation equivalent should be honored::
415
415
416
416
obj[**{}]
417
- # Error. Equivalent to obj[]
417
+ # Equivalent to obj[() ]
418
418
419
419
obj[3, **{}]
420
420
# Equivalent to obj[3]
@@ -836,7 +836,15 @@ This proposal already established that, in case no positional index is given, th
836
836
passed value must be the empty tuple. Allowing for the empty index notation would
837
837
make the dictionary type accept it automatically, to insert or refer to the value with
838
838
the empty tuple as key. Moreover, a typing notation such as ``Tuple[] `` can easily
839
- be written as ``Tuple `` without the indexing notation.
839
+ be written as ``Tuple `` without the indexing notation.
840
+
841
+ However, subsequent discussion with Brandt Bucher during implementation has revealed
842
+ that the case ``obj[] `` would fit a natural evolution for variadic generics, giving
843
+ more strength to the above comment. In the end, after a discussion between D'Aprano,
844
+ Bucher and the author, we decided to leave the ``obj[] `` notation as a syntax
845
+ error for now, and possibly extend the notation with an additional PEP to hold
846
+ the equivalence ``obj[] `` as ``obj[()] ``.
847
+
840
848
841
849
Sentinel value for no given positional index
842
850
--------------------------------------------
0 commit comments