On Dec 14, 2019, at 12:36, Christopher Barker <python...@gmail.com> wrote:
> 
> Of the top of my head, I can’t think of a single non-contrived example of 
> using a bare iterator in case that is not specifically doing something 
> “special”.

Calling iter on a container is hardly the only way to get an Iterator. You also 
get Iterators from open, map, filter, zip, genexprs, generator functions, most 
itertools functions, etc. And I’m pretty sure at least the first of those is 
learned pretty early and used pretty often by novices.

In fact, I think files are one of the most common ways people learn about 
iterators. There are certainly a lot of StackOverflow dups asking why `for line 
in file:` gives them no lines when just 10 lines earlier the same file had 20 
lines. 

_______________________________________________
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/BP2VRKZQMHRUTK765NYY3BQGN2LBWJTV/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to