Instead, it produces values on demand!

Generator Expressions could have saved me GIGABYTES of memory.

A generator expression can do all the cool stuff that a list comprehension can do but it does not create a list. Instead, it produces values on demand, which could save you LOTS AND LOTS of memory usage. Try it out!

Written by Loek van den Ouweland on 2023-09-10.
Questions regarding this artice? You can send them to the address below.