2 Comments
User's avatar
Tara's avatar

Even faster:

ls = list(range(N))

187 µs ± 45 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

Expand full comment
Taras Tsugrii's avatar

yep, I wrote about this in one of the previous articles and it's for the same reason why `map(int, ...)` is faster than `(int(i) for i in ...)`

Expand full comment