Is List an Iterable

A list is an iterable. But it is not an iterator. If we run the __iter__() method on our list, it will return an iterator. An iterator is an object with a state that remembers where it is during iteration.

Which objects are iterable in Python?

Iterable is an object which can be looped over or iterated over with the help of a for loop. Objects like lists, tuples, sets, dictionaries, strings, etc. are called iterables.

Which data structures are iterable in Python?

Iterables are a collection of important data structures in Python. For instance, built-in types such as strings, lists, and dictionaries are all iterables. If you have used higher-order functions, such as map and filter, you probably know that these functions create iterables too (i.e., map and filter objects).

Maya Lin-Takahashi

Maya Lin-Takahashi

Consumer Tech & Gadget Reviewer

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.

Share this article
Twitter Facebook Pinterest