Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Commit 8cbe6a3

Browse files
committed
Add return type to List.__getitem__
"a = [[]]; a[0].append(42)" now works.
1 parent 20ec71d commit 8cbe6a3

File tree

1 file changed

+1
-1
lines changed
  • stdlib/internal/types/collections

1 file changed

+1
-1
lines changed

stdlib/internal/types/collections/list.seq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class List[T]:
3939
def __bool__(self):
4040
return self.__len__() > 0
4141

42-
def __getitem__(self, idx: int):
42+
def __getitem__(self, idx: int) -> T:
4343
if idx < 0:
4444
idx += self.__len__()
4545
self._idx_check(idx, "list index out of range")

0 commit comments

Comments
 (0)