What types does for loop accept? /u/Informal-Addendum435 Python Education

def print_all(x: ???): for item in x: print(x) 

what should the typehint for the parameter be?

I guess collections.abc.Iterable, but I’d be surprised if for loops don’t also always work with Iterators too, and Iterators don’t have to also be Iterables

submitted by /u/Informal-Addendum435
[link] [comments]

​r/learnpython def print_all(x: ???): for item in x: print(x) what should the typehint for the parameter be? I guess collections.abc.Iterable, but I’d be surprised if for loops don’t also always work with Iterators too, and Iterators don’t have to also be Iterables submitted by /u/Informal-Addendum435 [link] [comments] 

def print_all(x: ???): for item in x: print(x) 

what should the typehint for the parameter be?

I guess collections.abc.Iterable, but I’d be surprised if for loops don’t also always work with Iterators too, and Iterators don’t have to also be Iterables

submitted by /u/Informal-Addendum435
[link] [comments] 

Leave a Reply

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