needleinthehay.de

Generators as List Comprehension

Generators save memory, and don’t always need separate functions. Use List Comprehension Syntax, but with (...) instead of [...].

sum((i * i for i in range(1, 2**28)))