Closed
Description
Here's example:
n = 20
for i in range(n):
if i == 3:
n = 1
print(i)
On uPy, this ends loop prematurely, while expected semantics of range is that it captures value it was initialized with, not reference to variable.
But what really made me look into this is the gross performance difference of using range with constant expression vs one with var as arg. My guess proper semantics would be to load the end value on stack at the beginning of iteration and use that afterwards...