[Tutor] iterators
Oscar Benjamin
oscar.j.benjamin at gmail.com
Sun Jan 19 20:02:11 CET 2014
On Jan 19, 2014 6:49 PM, "Keith Winston" <keithwins at gmail.com> wrote:
>
> Well, as usual thanks for all this, it's really great. I'd worked out
> that it was a distinction between iterators and iterables, though I'm
> going to Oscar's description a few more times: most of it made sense,
> but there are subtleties.
>
> For example, this from the Python 3.3 tutorial:
>
> We say such an object is iterable [referring to "range"], that is,
> suitable as a target for functions and constructs that expect
> something from which they can obtain successive items until the supply
> is exhausted. We have seen that the for statement is such an iterator.
> The function list() is another; it creates lists from iterables:
>
> Now, everything we've said thus far would not have led me to believe
> that one would call the for statement an iterator... is this just
> very, very loose use of the term (in the Python documentation!), or am
> I still missing something biggish?
I think that's just an editing mistake. If you replace the word "iterator"
with "construct" then it makes sense: We have seen that the for statement
is such a construct.
Oscar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140119/9400fb37/attachment.html>
More information about the Tutor
mailing list