Which Iterable should I use for type hinting? typing.Iterable vs. collections.abc.Iterable /u/pachura3 Python Education

The code seems to work with both, but perhaps one of these is deprecated…?

def get_squares(upper_range: int) -> Iterable[int]: return (x**2 for x in range(upper_range + 1)) for i in get_squares(10): print(i) 

submitted by /u/pachura3
[link] [comments]

​r/learnpython The code seems to work with both, but perhaps one of these is deprecated…? def get_squares(upper_range: int) -> Iterable[int]: return (x**2 for x in range(upper_range + 1)) for i in get_squares(10): print(i) submitted by /u/pachura3 [link] [comments] 

The code seems to work with both, but perhaps one of these is deprecated…?

def get_squares(upper_range: int) -> Iterable[int]: return (x**2 for x in range(upper_range + 1)) for i in get_squares(10): print(i) 

submitted by /u/pachura3
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *