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 feed loops, container constructors, and string joining without requiring manual indexing.
- How deep it goes
- Explains iteration through iter(), next(), and StopIteration, then tests iterability and works through constructor-based uses.
- Examples
- Shows task ID–title pairs built with dict(zip()), numeric strings converted with map(), and lists created from ranges.
- What you can do after
- Apply it via Python built-ins to test iterability and create or process containers without unnecessary indexing loops.
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.
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 →
Related concepts
- 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.
- 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.
- zipused by · Zip is an operation that combines corresponding elements from multiple iterables or collections into paired or otherwise combined results.
- generatorincludes · A generator is a language construct or computation that produces values incrementally on demand, typically suspending and resuming while preserving its state.
- 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.
- __iter__uses · __iter__ is a Python special method that returns an iterator for an object.
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.






