Eric Wieser <wieser.eric+py...@gmail.com> added the comment:
What I think I find surprising is that I'd expect the sequence protocol to be defined by `__getitem__` and `__len__`, and for `__iter__` to be inferred as: def __iter__(self): for i in range(len(self)): yield self[i] But in reality it seems it is inferred only from `__getitem__`, as: def __iter__(self): i = 0 while True: try: yield self[i] except IndexError: return i += 1 ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34494> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com