|
|
|
|
|
by kilburn
2751 days ago
|
|
No, what the docs say is that range is a generator. It never stores the entire list of values, but it does iterate through all the numbers, spitting them out one by one (hence it uses O(1) memory, but O(n) computation). Equivalent pseudocode: function in_range(x, a, b):
for i=a; i<b; i++:
if x == i return true
return false
|
|