Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
mysum.py - incorrect import of type Iterable from collections package
the code incorrectly imports collections.Iterable, instead of typing.Iterable. This error is not caught for python 3.9+ because of interpreter changes But for python 3.8, the code throws error - ``` $ python mysum.py Traceback (most recent call last): File "mysum.py", line 10, in <module> def sum(it: Iterable[T]) -> Union[T, int]: ... # <2> ```
  • Loading branch information
anagri authored Aug 12, 2023
commit 48d01ce2af6b94a8e65e2c915e5149a678d74750
3 changes: 1 addition & 2 deletions 15-more-types/mysum.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import functools
import operator
from collections.abc import Iterable
from typing import overload, Union, TypeVar
from typing import overload, Union, TypeVar, Iterable

T = TypeVar('T')
S = TypeVar('S') # <1>
Expand Down