Python's range is a lazy sequence PREMIUM

Series: Looping
Trey Hunner smiling in a t-shirt against a yellow wall
Trey Hunner
4 min. read 3 min. video Python 3.8—3.12

Python's range objects are lazy sequences.

range objects don't store their values

If you make a very large range, Python will make the range object very quickly.

...

A Python Tip Every Week

Need to fill-in gaps in your Python skills? I send weekly emails designed to do just that.