Reading a Pipeline of Iterators

A generator pipeline passes values through stages as consumers request them. Each stage supplies a documented transformation or filtering rule.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Trace which values reach a stage
  2. Account for stateful steps

Trace which values reach a stage

Given 2, minus 3, and 8, a nonnegative filter followed by doubling supplies 4 and 16. Requesting just the first result need not inspect minus 3 or 8. Filtering and lazy transforms explain that demand-driven behavior.

Account for stateful steps

A running sort cannot normally emit a global minimum without deciding when all input has been seen. Identify operations that buffer or need the end of their source before promising incremental output.[1]

References

  1. Python Software Foundation, Functional Programming HOWTO ↩