Documentation
It is not exactly clear when the iterator returned by iter(seq) stops, where the type of seq implements __getitem__ . It was only by consulting the ABI docs that I found out it stops when IndexError is raised, and by experimenting in the console that only __length_hint__ on the iterator calls __len__ on seq if present and subtracts it by the number of items yielded. I believe this can be better documented, preferably in the iter() function documentation, which only mentions:
or it must support the sequence protocol (the __getitem__() method
with integer arguments starting at 0)
with no further explanation.
Documentation
It is not exactly clear when the iterator returned by
iter(seq)stops, where the type ofseqimplements__getitem__. It was only by consulting the ABI docs that I found out it stops whenIndexErroris raised, and by experimenting in the console that only__length_hint__on the iterator calls__len__onseqif present and subtracts it by the number of items yielded. I believe this can be better documented, preferably in theiter()function documentation, which only mentions:with no further explanation.