What is the name of the built-in function to create an iterator that aggregates elements from multiple iterables?

The story behind the answer

What is the name of the built-in function to create an iterator that aggregates elements from multiple iterables? It is zip. The function takes two or more iterables and produces an iterator whose items are tuples containing corresponding elements from each input.

For example, zip([1, 2], ["a", "b"]) yields (1, "a") and (2, "b"). In modern Python, zip is lazy: calling it does not immediately build a complete list, so it can combine large or even unbounded iterables efficiently. Values are produced as the resulting iterator is consumed, often by a for loop or by list().

By default, zip stops when the shortest input iterable is exhausted. That behavior is useful when pairing records, but it can hide mismatched lengths; Python 3.10 added the strict=True option to raise ValueError when inputs differ in length. The related concept is called zipping in computer science. “Map” transforms values with a function, while enumerate adds indexes; neither specifically pairs parallel iterables.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: