A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-July/074002.html below:

[Python-Dev] Terminology of "Iterable" and "Iterator"

[Python-Dev] Terminology of "Iterable" and "Iterator"Calvin Spealman ironfroggy at gmail.com
Wed Jul 25 14:18:48 CEST 2007
I got into a discussion about this, which made me think it would make
sense to formalize a distinction between "iterable" and "iterator". To
nearly any python developer I talk with, we can define them as:

iterable - An object which can be passed to the built-in iter()
function, which returns an iterator.

iterator - An object with a .next() method, which is used to invoke
the iteration. An iterator _should_ also be an iterable, and will
nearly always return itself as its own iterator.

Now, the current documentation makes no distinction, and we see this
in the docstring for iter(), which is curious:

    iter(collection) -> iterator

This might indicate that it is using "collection" where I would say
"iterable". Also, the same docstring makes mention of something being
an iterator _or_ a sequence, so I also should bring up that it may be
antiquated, yes?

-- 
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://ironfroggy-code.blogspot.com/
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4