Closed
Description
Hello, consider the following program:
x = 0
def f():
global x
x += 1
return x
L = [(f(), f()) for i in range(4)]
print(L)
L = [(f(), f())[::-1] for i in range(4)]
print(L)
When I execute it with the Python interpreter the output matches my expectation:
[(1, 2), (3, 4), (5, 6), (7, 8)]
[(10, 9), (12, 11), (14, 13), (16, 15)]
But when I execute it with Codon 0.15.3 the output is another:
[(1, 2), (3, 4), (5, 6), (7, 8)]
[(10, 11), (14, 15), (18, 19), (22, 23)]
It looks like some lazy computation produces the wrong result.
Metadata
Metadata
Assignees
Labels
No labels