Chris Angelico writes: > > (Technical note: for the convenience of implementors of 'for', > > when iter is applied to an iterator, it always returns the > > iterator itself.) > > That's not a mere technical detail - that's actually part of the > definition of an iterator, namely that iter(x) is x. That's how you > can tell that it's an iterator.
>From the point of view of teaching iterators to novices, I think it *is* a technical detail. As has been pointed out, there are languages where iterators are *never* iterable. What's *necessary* to an iterator as a concept is that it have a __next__. Python chooses to define the iterator protocol with __iter__ being the identity for iterators because it makes implementing *for* straightforward. > I don't like this term "converted". I refuse to die on that hill. :-) Suggest a better term, I'll happily use it until something even better comes along. Or I'll try to come up with a better one as I think about the documentation issue. Steve _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/GEHAU3QUWSIBTWS76DCH3WGMPWX3FMST/ Code of Conduct: http://python.org/psf/codeofconduct/