[Python-ideas] Introduce collections.Reiterable
Steven D'Aprano
steve at pearwood.info
Sun Sep 22 12:55:58 CEST 2013
On Sun, Sep 22, 2013 at 10:58:40AM +0200, Georg Brandl wrote:
> > Or you could just use the existing terminology and talk about
> > iterables vs iterators instead of inventing your own terms.
>
> Ack. Please don't create new terms, rather suggest an improvement to the
> glossary definition if you think it's inadequate.
I'm not inventing new terminology. I'm using the plain English meanings
of "directly" and "indirectly", and the standard meaning of "iterate",
"iterator", "iterable" as used by Python and described in the glossary.
As the glossary says, "The for statement [calls iter] for you, creating
a TEMPORARY UNNAMED VARIABLE to hold the iterator for the duration of
the loop." [emphasis added] All I am doing is distinguishing between the
iterable object that the for-loop calls iter() on, which need not have a
__next__ method, and the iterable object that the for-loop calls
__next__ on. They're not always the same object.
But as I've already said, the distinction usually doesn't matter. I've
already forgotten the context of why I thought it mattered when I first
raised it *wink*
--
Steven
More information about the Python-ideas
mailing list