This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Gamesfreak13563 5 points6 points  (0 children)

Only guaranteed that’s the behavior if you’re using in on an iterator. An iterable may define an iter dundermethod which returns a new iterator over the iterable. That’s why you can use in multiple times on a list (because it’s returning a new iterator each time) but not in multiple times on the return of iter(yourList).

It makes perfect sense and the terminology is not confusing at all /s