Comprehensions

Build a list, in one line

A list comprehension builds a new list by transforming (and optionally filtering) another collection โ€” all in one expression instead of a loop with .append() calls:

names = [w["name"] for w in walkers]

Read it left to right: "give me w["name"], for each w in walkers." It's the Python equivalent of Swift's walkers.map { $0["name"] }.