Invent your own comprehensions in Python
SMRTR summary
Python lacks tuple and frozenset comprehensions, but generator expressions can simulate custom comprehensions for any iterable-accepting callable. By passing generator expressions to constructors like tuple() or frozenset(), or reducer functions like sum() and any(), developers can create comprehension-like syntax for collections and operations not natively supported by Python's comprehension syntax.
SMRTR provides this summary for quick context. The original article belongs to Python Morsels.
Read the original article