🔵 🔵 🔵


Primary

၊၊||၊|။

''generator expression'' ⚬|Definition|1st|20260605182851-00-⌔

Glossary — Python 3.14.2 documentation#term-generator-expression

generator expression

An expression that returns an iterator. It looks like a normal expression followed by a for clause defining a loop variable, range, and an optional if clause. The combined expression generates values for an enclosing function:

>>> sum(i﹡i for i in range(10))         # sum of squares 0, 1, 4, ... 81
285

Printed 2026-06-28.

(echo:: @ )

Link to original

Secondary

• • •