fixed typo

This commit is contained in:
pca006132 2020-12-15 18:01:01 +08:00 committed by pca006132
parent 8aa4fc18a7
commit 2484f772b3
1 changed files with 3 additions and 3 deletions

View File

@ -106,13 +106,13 @@ class Derived(Base):
def foo(self) -> int: def foo(self) -> int:
return 2 return 2
def bar(x: [Base]) -> int: def bar(x: list[Base]) -> int:
sum = 0 sum = 0
for v in x: for v in x:
sum += v.foo() sum += v.foo()
return sum return sum
# incorrect, the type signature of the list is `[virtual[Base]]` # incorrect, the type signature of the list is `list[virtual[Base]]`
bar([Base(), Derived()]) bar([Base(), Derived()])
``` ```
@ -124,7 +124,7 @@ inlining etc.
Example: Example:
```py ```py
def bar2(x: [virtual[Base]]) -> int: def bar2(x: list[virtual[Base]]) -> int:
sum = 0 sum = 0
for v in x: for v in x:
sum += v.foo() sum += v.foo()