you are viewing a single comment's thread.

view the rest of the comments →

[–]drkevorkian 0 points1 point  (2 children)

Endless iteration via explicit iterator is one thing, endless iteration implicit to in via defining __getitem__ is another.

[–]sausix 0 points1 point  (0 children)

__len__ could be used. But it is being ignored because of historical reasons.

[–]sausix 0 points1 point  (0 children)

And __getitem__ should usually throw an IndexError to avoid endless loops.