On this page
  1. map
  2. Import & Availability
  3. Overview & Signature
  4. Usage
  5. Gotchas
  6. REPL Inspect

map

Prev: locals | Up: __builtins__ | Next: max
Rel: all, any, enumerate, filter, iter
Ref: docs.python.org — map
Tags: #public #python3 #builtins


Import & Availability

# Built-in (available globally without import)
from builtins import map

Overview & Signature

map(function, iterable, /, *iterables, strict=False)

Make an iterator that computes the function using arguments from each of the iterables. Stops when the shortest iterable is exhausted.

Usage

assert list(map(str.upper, ["a", "b"])) == ["A", "B"]
assert list(map(pow, [2, 3, 4], [3, 2, 1])) == [8, 9, 4]

Gotchas

REPL Inspect

help(map)

Linked from

Related notes