*Memo:
- mypy test.py
- mypy 1.19.1
- Python 3.14.0
- Windows 11
The example in the doc gets another error in addition to the error which the example wants to show as shown below:
def foo(arg: list[int]) -> None:
print('Items:', ', '.join(arg)) # Anther error
a = [] # Error: Need type annotation for "a"
foo(a)
error: Argument 1 to "join" of "str" has incompatible type "list[int]"; expected "Iterable[str]"
So, it should be as shown below:
def foo(arg: list[int]) -> None:
print('Items:', ''.join(str(a) for a in arg))
a = [] # Error: Need type annotation for "a"
foo(a)
*Memo:
The example in the doc gets another error in addition to the error which the example wants to show as shown below:
So, it should be as shown below: