Home / Glossary / List Comprehension
PythonList Comprehension
By Sitraka Forler · Lecturer, Durham Business SchoolUpdated 13 September 2026 About this site
Compact syntax to build a list from an iterable.
List comprehensions replace verbose for-loops with a one-line expression. They are idiomatic Python and often faster than equivalent loops.
Example
returns = [p/prices[i-1]-1 for i, p in enumerate(prices[1:], 1)]