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/
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to