Iterable
An iterable is an object or value that provides or supports a protocol for producing its elements sequentially.
Python Workout, Second Edition
An iterable is a Python object that can provide its elements one at a time for iteration.
- How it is used
- Uses iterables to drive for loops, comprehensions, argument unpacking, and transformations across Python data structures.
- How deep it goes
- Defines the iterator protocol and distinguishes iterables from iterators, while deferring deeper protocol practice to custom iterators and generators.
- Examples
- Demonstrates strings, lists, dictionaries, files, ranges, numeric joining, hexadecimal conversion, comprehensions, and custom enumeration.
- What you can do after
- Build iterable classes and generator functions, then diagnose for-loop behavior through __iter__, __next__, and StopIteration.
Python How-To
- How it is used
- Uses iterables to process items in loops and create containers from existing data.
- How deep it goes
- Explains iterator creation, item retrieval, exhaustion, and practical iterability checks.
- Examples
- Uses task lists, ID-title mappings, string conversion, and an iterability test.
- What you can do after
- Apply it using Python’s iteration and container-construction tools to inspect and process existing data.
Python Workout: 50 ten-minute exercises
An iterable is a Python object that can provide its elements sequentially to an iteration process.
- How it is used
- Deploys iterables as common inputs for for loops, comprehensions, built-in functions, argument unpacking, and generator expressions.
- How deep it goes
- Descends from everyday loops to __iter__, __next__, StopIteration, custom iterator classes, generators, and generator expressions.
- Examples
- Demonstrates lists, strings, dictionaries, files, range, comprehensions, argument unpacking, custom iterators, and hexadecimal conversion.
- What you can do after
- Build iterable classes, apply comprehensions and generator expressions, unpack iterable arguments, and distinguish iterable from non-iterable objects.
Read how Python Workout: 50 ten-minute exercises explains iterable →
Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond
An object or value that can be traversed element by element by the iteration protocol.
- How it is used
- Uses iterables to visit values with `for..of` and collect them with spread across built-in and custom objects.
- How deep it goes
- Explains `Symbol.iterator`, iterator creation, `next()`, `value`, and `done`, then shows a generator as a shorter implementation.
- Examples
- Uses prime-number iterators, string-character spread, and an exercise that takes ten values from an infinite iterable.
- What you can do after
- Build it from scratch with `Symbol.iterator` and `next()`, or use a generator; customize iteration and consume infinite iterables selectively.
Secrets of the JavaScript Ninja, Third Edition
An iterable is an object that exposes an iteration protocol allowing its values to be traversed sequentially.
- How it is used
- Uses iterables to traverse values with for...of, destructuring, and spread, and as the return type of generator functions.
- How deep it goes
- Explains Symbol.iterator, next(), iterator results, custom iterables, lazy values, and generator behavior.
- Examples
- Uses array iteration, a custom random-number iterable, destructuring, spread, and an infinite generator.
- What you can do after
- Build it from scratch by implementing Symbol.iterator and next(), then consume values with JavaScript iteration syntax.
Read how Secrets of the JavaScript Ninja, Third Edition explains iterable →
Practices of the Python Pro
- How it is used
- Uses iterables to discuss Python data traversal, memory efficiency, and helper functions such as max.
- How deep it goes
- Defines iteration, compares collection storage with generators, and explains yield behavior without developing protocol internals.
- Examples
- Uses for loops, range-like generators, squared-number generators, and maximum-frequency lookup over dictionary data.
- What you can do after
- Apply it via Python loops, generators, and iterable-aware functions while reducing unnecessary memory use.
The Joy of JavaScript
An iterable is an object or value that can be consumed by an iteration protocol to produce a sequence of elements.
- How it is used
- Supports uniform consumption of domain objects, custom collections, generated sequences, and streams through standard JavaScript syntax.
- How deep it goes
- Explains Symbol.iterator, next, value, done, generators, async iteration, and early termination, but defers complete protocol details.
- Examples
- Uses blockchain models, transaction blocks, random-number iterators, strings, generated blocks, and Validation branches.
- What you can do after
- Build it from scratch by implementing Symbol.iterator or a generator, then consume custom sequences with for...of, spread, or destructuring.
100 Java Mistakes and How to Avoid Them
Iterable is a Java interface whose objects can provide an Iterator for traversing their elements.
- How it is used
- Uses Iterable to expose traversal through enhanced-for loops and general collection utilities.
- How deep it goes
- Explains enhanced-for mechanics and iterator contracts, then demonstrates stateful and buffered implementations.
- Examples
- Demonstrates numeric ranges, Collections.min(), BufferedReader lines, and IntStream.range().iterator().
- What you can do after
- Builds contract-compliant custom iterators and diagnose implementations that depend on enhanced-for-only call patterns.
Read how 100 Java Mistakes and How to Avoid Them explains iterable →
Also covered in
- Spring in Action, Sixth Edition
- Julia as a Second Language
- Django in Action
- The Quick Python Book, Fourth Edition
- Tiny Python Projects: Learn coding and testing with puzzles and games
- Essential TypeScript 5, Third Edition
What to know first
- loopA loop is a programming-language control-flow construct that repeatedly executes a block of instructions according to an iteration rule or continuation condition.
- MapA map is an associative data structure that stores key-value associations and supports retrieving values by key.
- iteratorAn iterator is an object or abstraction that provides successive values from a collection or other data source through a traversal interface.
- classA class is a programming-language construct that defines a type’s structure and behavior and provides a basis for creating or representing objects.
Related concepts
- enumerateused by · enumerate is an iteration utility that yields pairs containing sequential indices and corresponding items from an iterable, optionally starting at a specified index.
- sortedused by · sorted is a Python built-in function that returns a new list containing an iterable’s elements in sorted order without modifying the original iterable.
- zipused by · Zip is an operation that combines elements from multiple sequences at corresponding positions into paired or mapped results.
- eductionproduced by · eduction is a Clojure function that applies one or more transducers lazily to a collection and returns a non-caching sequential view of the transformed results.
- generatorincludes · A generator is a language construct or computation that produces values incrementally on demand, typically suspending and resuming while preserving its state.
Questions about iterable
What is iterable?
An iterable is an object or value that provides or supports a protocol for producing its elements sequentially.
Which Manning books explain iterable?
Python Workout, Second Edition, Python How-To, Python Workout: 50 ten-minute exercises, Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond, Secrets of the JavaScript Ninja, Third Edition, Practices of the Python Pro, The Joy of JavaScript and 100 Java Mistakes and How to Avoid Them.
What should I know before learning iterable?
Manning books that teach iterable usually introduce loop, Map, iterator and class first.
What kinds of iterable are there?
Kinds of iterable include generator.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.







