Built-in Functions and Types

map()

Apply a callable to items on demand. With several inputs, one argument comes from each iterable and processing ends when the shortest is exhausted. The callable runs during consumption, not when map is created. For CPython 3.13 there is no strict keyword; newer versions require separate evidence. Use a comprehension for eager transformation or list(map(...)) to collect results.

Formal Syntax & Structure

python syntaxpython
map(function, iterable, /, *iterables)

Parameters & Attributes

NameTypeDescription
functioncallableReceives one item per source on each iteration.
iterableiterableFirst input source.
iterablesadditional iterablesFurther parallel inputs, if needed.

Return Value

map iterator

Single-pass lazy stream of callable results.

Working Example

Example Snippetpython
prices = [3, 5, 8]quantities = [2, 1, 4]print(list(map(lambda p, q: p * q, prices, quantities)))
Python Reference