
I think maybe some of the trouble here, particularly in teaching is the word "is" (in English, not the Python keyword). As in: "A file object IS and iterator" and "A zip object IS an iterator" I know in OO parlance, "is a" can be used to designate subclassing (or an appropriate use for it) and it can be made a bit more generic to mean "has the interface of" -- which is how we are using it here. But in common language, there might be a bit of confusion: something is an iterator among other things vs something is PRIMARILY an iterator File objects are a good example: A file object provides all sorts of things, and iteration is only a small part of it. In fact, maybe due to my long history with working with pre-iterator file objects (python 1.5! -- yes, I am that old) I see them as fully featured objects that also happen to provide an iteration interface to line-oriented access to text files as a convenience -- calling them "an iterator" feels a bit odd. Whereas things like the zip iterator, and many of the things in itertools, do primarily (only) iteration -- calling them "an iterator" makes a huge amount of sense. Even more so for things like list_iter, that are generally hidden from the user, and exist only to provide iteration. In fact, that's why I think file objects may be one of the worst ways to introduce the iteration protocol to newbies. (though maybe because of the confusion, it's a good example of why it matters to understand the distinctions) Iterables, on the other hand, usually provide a bunch of functionally other than iterability -- and indeed, most are fully functional without the iterator protocol at all. (maybe with ugly code :-) ) -CHB On Fri, May 15, 2020 at 6:14 AM Steven D'Aprano <steve@pearwood.info> wrote:
On Fri, May 15, 2020 at 05:58:16AM -0400, Ricky Teachey wrote:
Perhaps use the iter function name as the generic? "itered". As opposed to "iterated" or "iterated over".
Example:
"the statement below iterates over an iterator, itered from a sequence"
Or just avoid the issue:
"The statement below iterates over a sequence"
which is perfectly valid and correct.
If we do feel the need to drill down into pedantic technical details, instead of making up ugly words that nobody will have any clue whatsoever what the meaning is[1], we could use one of many existing English words:
built from formed from constructed from made from fabricated from created from put together from
etc. And notice I avoided using terms which imply that the sequence itself is transformed into an iterator, such as "converting into".
[1] "Iter" is an old term for a passage, in particular an anatomical term for a passage in the brain, so "itered" would be the past tense of a verb to turn something into a passage.
-- Steven _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@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/CQM25A... Code of Conduct: http://python.org/psf/codeofconduct/
-- Christopher Barker, PhD Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython