Iteration is a general term for taking each item of something, one after another. Any time you use a loop, explicit or implicit, to go over a group of items, that is iteration.

In Python, iterable and iterator have specific meanings.

An iterable is an object that has an __iter__ method which returns an iterator, or which defines a __getitem__ method that can take sequential indexes starting from zero (and raises an IndexError when the indexes are no longer valid). So an iterable is an object that you can get an iterator from.

An iterator is an object with a next (Python 2) or __next__ (Python 3) method.

Whenever you use a for loop, or map, or a list comprehension, etc. in Python, the next method is called automatically to get each item from the iterator, thus going through the process of iteration.

A good place to start learning would be the iterators section of the tutorial and the iterator types section of the standard types page. After you understand the basics, try the iterators section of the Functional Programming HOWTO.

Answer from agf on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-difference-iterable-iterator
Python | Difference between iterable and iterator - GeeksforGeeks
July 11, 2025 - Iterable is an object, that one can iterate over. It generates an Iterator when passed to iter() method. An iterator is an object, which is used to iterate over an iterable object using the __next__() method.
Top answer
1 of 15
679

Iteration is a general term for taking each item of something, one after another. Any time you use a loop, explicit or implicit, to go over a group of items, that is iteration.

In Python, iterable and iterator have specific meanings.

An iterable is an object that has an __iter__ method which returns an iterator, or which defines a __getitem__ method that can take sequential indexes starting from zero (and raises an IndexError when the indexes are no longer valid). So an iterable is an object that you can get an iterator from.

An iterator is an object with a next (Python 2) or __next__ (Python 3) method.

Whenever you use a for loop, or map, or a list comprehension, etc. in Python, the next method is called automatically to get each item from the iterator, thus going through the process of iteration.

A good place to start learning would be the iterators section of the tutorial and the iterator types section of the standard types page. After you understand the basics, try the iterators section of the Functional Programming HOWTO.

2 of 15
430

Here's the explanation I use in teaching Python classes:

An ITERABLE is:

  • anything that can be looped over (i.e. you can loop over a string or file) or
  • anything that can appear on the right-side of a for-loop: for x in iterable: ... or
  • anything you can call with iter() that will return an ITERATOR: iter(obj) or
  • an object that defines __iter__ that returns a fresh ITERATOR, or it may have a __getitem__ method suitable for indexed lookup.

An ITERATOR is an object:

  • with state that remembers where it is during iteration,
  • with a __next__ method that:
    • returns the next value in the iteration
    • updates the state to point at the next value
    • signals when it is done by raising StopIteration
  • and that is self-iterable (meaning that it has an __iter__ method that returns self).

Notes:

  • The __next__ method in Python 3 is spelt next in Python 2, and
  • The builtin function next() calls that method on the object passed to it.

For example:

>>> s = 'cat'      # s is an ITERABLE
                   # s is a str object that is immutable
                   # s has no state
                   # s has a __getitem__() method 

>>> t = iter(s)    # t is an ITERATOR
                   # t has state (it starts by pointing at the "c"
                   # t has a next() method and an __iter__() method

>>> next(t)        # the next() function returns the next value and advances the state
'c'
>>> next(t)        # the next() function returns the next value and advances
'a'
>>> next(t)        # the next() function returns the next value and advances
't'
>>> next(t)        # next() raises StopIteration to signal that iteration is complete
Traceback (most recent call last):
...
StopIteration

>>> iter(t) is t   # the iterator is self-iterable
Discussions

iterator and iterable object, is there a difference?
An iterator is an object which has a __next__ method. An iterable is an object which has a __getitem__ method or has an __iter__ method. You iterate over things with an iterator. You can get an iterator from an iterable. The syntax for x in iterable calls iter(iterable) to get an iterator, then uses that iterator until StopIteration is thrown. Roughly equivalent to this: try: it = iter(iterable) while True: do_thing_with(next(it)) except StopIteration: pass Here's a repl.it with an example of each: https://repl.it/KNPC/0 More on reddit.com
🌐 r/learnpython
12
3
August 17, 2017
Iterators and Iterables in Python: Run Efficient Iterations – Real Python
ELI5 - difference between iterator and iterable. More on reddit.com
🌐 r/Python
6
44
March 2, 2023
Iterators and iterables in Python

Iterator protocol mandates that __iter__ method be implemented on the object.

Iterator is an object which implements __next__.

__iter__ method mandates that an iterator be returned from it

That's not true. I can return, let's say, integer in __iter__. I won't be able to iterate over that, but I can do that.

Except that, this article is ok, but it would be ok to mention that this code is about Python 2.x. In Python 3.x there's no next() special method, but __next__().

More on reddit.com
🌐 r/Python
6
6
October 12, 2017
Python's iterators are a bad implementation of laziness
The problem is that Python promotes the use of identical syntax for multiple, similar representations of data. Examples: foo = (1,2,3) print(", ".join(map(str,foo))) print(", ".join(map(str,foo))) Gives: 1, 2, 3 1, 2, 3 Next: foo = [1,2,3] print(", ".join(map(str,foo))) print(", ".join(map(str,foo))) Gives: 1, 2, 3 1, 2, 3 Next: foo = xrange(1, 4) print(", ".join(map(str, foo))) print(", ".join(map(str, foo))) Gives: 1, 2, 3 1, 2, 3 This is great, because duck typing means we don't need to explicitly state which type an object has, we simply need to know to which methods it responds. By defining standard interfaces and syntaxes, we know that we can expect ", ".join(map(str, foo)) to work if foo is enumerable. So, if we have a function that takes an enumerable object as an argument, it should work if we change its parameter from a tuple to an array, or from an array to a range. However, if we then switch it to a generator because our input is now too large to load into memory all at once (for example): def gen(list): for item in list: yield item foo = gen([1, 2, 3]) print(", ".join(map(str, foo))) print(", ".join(map(str, foo))) Gives: 1, 2, 3 (blank line) This is a valid concern, because it does not match other enumerable objects. One might argue that this is a contrived example (it is), and that if you are switching your code to use generators, it is probably for reasons of efficiency. If you're optimizing your code, then you shouldn't be using a generator twice like I've done here, that's just silly. And you'd be right. However, the person reading the code expects calling ", ".join(map(str, foo)) twice to take twice as long, and it's far easier to debug that than your enumerable object suddenly containing no objects halfway through a function definition, because you switched its data type in another part of the program. EDIT: I suck at markdown More on reddit.com
🌐 r/programming
100
35
June 29, 2009
🌐
Real Python
realpython.com › python-iterators-iterables
Iterators and Iterables in Python: Run Efficient Iterations – Real Python
January 6, 2025 - For example, Python built-in container types—such as lists, tuples, dictionaries, and sets—are iterable objects. They provide a stream of data that you can iterate over. However, iterators are also iterable objects even if they don’t hold the data themselves. You’ll learn more about this fact in the section Comparing Iterators vs Iterables.
🌐
YouTube
youtube.com › watch
Iterable VS Iterator Explained In Python - YouTube
Today we’re going to be learning the difference between Iterators and Iterables in Python. They sound the same, and are almost spelled exactly the same (like...
Published: August 16, 2024
🌐
Reddit
reddit.com › r/learnpython › iterator and iterable object, is there a difference?
r/learnpython on Reddit: iterator and iterable object, is there a difference?
August 17, 2017 -

My book says "any object with a .next() method is called an iterator, which returns the next value in the range and raises the StopIt exception upon reaching the end".

However, range() function has no next() method, and is however, said to return an iterable object. Thus:

x = range(1, 10)
x.__next__()

returns an error. But, the file iterators:

x = open("file.txt")
x.__next__()

Doesn't return an error. Is there a difference between iterators and iterable objects?

🌐
DEV Community
dev.to › pkutaj › explaining-iterable-vs-iterator-in-python-4c3a
Explaining Iterable vs Iterator in Python - DEV Community
December 31, 2024 - iterable object (collection or stream of objects) is any object that can be passed into the built-in iter() function
Find elsewhere
🌐
Codeling
codeling.dev › blog › python-iterators-vs-iterables
Python Iterators vs Iterables Explained with Examples
May 26, 2025 - So far, we’ve built iterators using the raw protocol: implement __iter__() and __next__(), and you’re good to go. But Python being Python, there's a formal way to say, "Hey, this class is an iterator." That’s where collections.abc.Iterator comes in.
🌐
Towards Data Science
towardsdatascience.com › home › data science › iterables vs iterators in python
Iterables vs Iterators in Python | Towards Data Science
January 11, 2022 - Note that the preferred way to implement Iterables in recent Python versions is by implementing __iter__() method. The __getitem__() method is a sort of a legacy functionality that was used prior to modern iterators. But Python still considers objects implementing __getitem__() method as Iterables.
🌐
Medium
medium.com › analytics-vidhya › iterable-vs-iterator-in-python-eda1295a815e
Iterable vs Iterator in Python
September 27, 2021 - Iterators don’t have to be finite.It’s perfectly reasonable to write an iterator that produces an infinite stream of data. In Python,Iterable is anything you can loop over with a for loop.
🌐
AskPython
askpython.com › python › iterable-vs-iterator
Iterable vs Iterator in Python - What is the difference? - AskPython
July 6, 2021 - In Python, an iterator is an object which is obtained from an iterable object by passing it to the iter() function. An iterator holds a countable number of values that can be iterated upon.
🌐
KDnuggets
kdnuggets.com › 2022 › 01 › understanding-iterables-iterators-python.html
Understanding Iterables vs Iterators in Python - KDnuggets
January 27, 2022 - An iterable implements the __iter__() method and returns an iterator object. However, if the __iter__() method is not defined, Python will use __getitem__() instead.
🌐
Scaler
scaler.com › home › topics › difference between iterable and iterator in python
Difference between Iterable and Iterator in Python - Scaler Topics
February 12, 2024 - Iterators implement both the __iter__() and __next__() methods. Iterators facilitate iteration over iterables. The __iter__() method in Python returns an iterator object for iterables. For example, we pass a list to the iter() method and it returns a fresh new iterator.
🌐
Python Tutorial
pythontutorial.net › home › advanced python › python iterator vs iterable
Python Iterator vs Iterable: Explain Clearly via Examples
March 27, 2025 - An object is iterable when it implements the __iter__ method. And its __iter__ method returns a new iterator. In Python, a list is an ordered collection of items. It’s also an iterable because a list object has the __iter__ method that returns an iterator.
🌐
BYJUS
byjus.com › gate › difference-between-iterable-and-iterator-in-python
Difference Between Iterable and Iterator in Python
September 30, 2022 - Remember that every iterator is basically iterable, but vice versa is not always true. For instance, a list can be iterable but not an iterator. We can create an iterator from an iterator using the iter() function.
🌐
YouTube
youtube.com › watch
Python Iterator vs Iterable (Visually Explained) | enumerate, map, filter | #Python Course 31 - YouTube
Visually explained the difference between iterators and iterables in Python using enumerate, map, and filter with simple examples.Want More? 👇- *Python Han...
Published: October 23, 2025
🌐
Python Engineer
python-engineer.com › posts › iterable-vs-iterator
Difference between iterator and iterable in Python - Python Engineer
April 12, 2022 - More about this later. But when using iterables, it is usually not necessary to call iter() or deal with the iterator objects yourself. The for statement does that automatically, creating a temporary unnamed variable to hold the iterator for the duration of the loop (Python docs).
🌐
Medium
medium.com › analytics-vidhya › iterable-vs-iterator-python-d14aedaa0197
Iterable vs Iterator — Python
October 4, 2021 - We see iterators are iterables but they are iterables that get exhausted.
🌐
Machine Learning Plus
machinelearningplus.com › blog › iterators in python – what are iterators and iterables?
Iterators in Python - What are Iterators and Iterables? - machinelearningplus
March 8, 2022 - Iterable in Python is any object that can be looped over. In order for an iterable to be looped over, an iterable needs to be converted to an iterator using the __iter__() method. Once created, it is actually the iterator that gets iterated over.