liveBook · Manning

Comprehension

A comprehension is a language construct that creates a collection by iterating over one or more sources, optionally filtering elements and transforming them.

How 6 Manning books explain it

Python How-To

A list comprehension is Python syntax for constructing a list by iterating over an iterable and optionally filtering or transforming its items.

How it is used
Creates list, dictionary, or set objects from iterables when their items need transforming or filtering.
How deep it goes
Explains expression and filter syntax, compares loops, and works through nested iteration while discouraging more than two layers.
Examples
Uses task titles and urgency filtering, squares with duplicate set results, and nested task data.
What you can do after
Build it from scratch to transform or filter iterables into containers, choosing constructors or loops when they read better.

Read how Python How-To explains comprehension →

The Quick Python Book, Fourth Edition

A list comprehension is a Python expression that constructs a list by iterating over an iterable and optionally filtering or transforming its elements.

How it is used
Replaces common for loops that transform or select items to create lists, sets, or dictionaries.
How deep it goes
Defines list, set, and dictionary syntax and works through transformation and filtering, without descending into implementation internals.
Examples
Squares and filters a four-item list, builds a dictionary of squares, and filters alphabetic words in a word count.
What you can do after
Build it from scratch to transform or filter an iterable into a list, set, or dictionary.

Read how The Quick Python Book, Fourth Edition explains comprehension →

Learn Haskell by Example

A list comprehension is a Haskell expression that constructs a list by evaluating an element expression over values generated and conditionally selected by its clauses.

How it is used
Uses list comprehensions to generate, filter, and combine candidate words for a word-ladder graph.
How deep it goes
Defines generators, guards, Cartesian products, and pattern matching, but does not discuss implementation internals.
Examples
Uses arithmetic filtering, Cartesian-product pairs, and word insertion, deletion, and replacement candidates.
What you can do after
Builds concise Haskell list transformations with generators, guards, and multiple input lists.

Read how Learn Haskell by Example explains comprehension →

Functional Programming in JavaScript

A concise syntax for producing arrays by combining iteration and filtering expressions.

How it is used
Uses iteration and filtering to assemble a new array while emphasizing the intended result over loop mechanics.
How deep it goes
Defines the syntax and gives a worked example, but does not detail its implementation internals.
Examples
Uses people born in 1903, fullname selection, and joining the resulting names.
What you can do after
Apply array-comprehension syntax to combine filtering and mapping in a concise JavaScript expression.

Read how Functional Programming in JavaScript explains comprehension →

F# in Action: A Revised Edition of Get Programming with F#

A collection comprehension is syntax for constructing a collection from generator, filtering, and transformation logic.

How it is used
Uses executable expressions to construct sequences and turn imperative or external inputs into composable data pipelines.
How deep it goes
Explains syntax, conditional emission, yield versus yield!, generated streams, and pipeline use, but does not develop formal semantics.
Examples
Demonstrates conditional sequence values, date streams, Monday selection, console commands, and event-driven input pipelines.
What you can do after
Build it from scratch using sequence comprehensions, then apply standard sequence operations to generated dates, console input, or event data.

Read how F# in Action: A Revised Edition of Get Programming with F# explains comprehension →

Statistics Every Programmer Needs

A list comprehension is a Python syntax construct that creates a list by evaluating an expression for items from an iterable, optionally subject to a condition.

How it is used
Builds objective coefficients, constraint rows, and variable bounds for a feature-selection optimization model.
How deep it goes
Explains syntax through working optimization transformations but stops short of broader comprehension variants or performance analysis.
Examples
Demonstrates priority ratios, cost-matrix rows, epic constraint rows, and binary bounds derived from feature records.
What you can do after
Apply it via Python to generate solver-ready coefficients, matrices, and bounds from iterable feature objects.

Read how Statistics Every Programmer Needs explains comprehension →

Related concepts

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.