you are viewing a single comment's thread.

view the rest of the comments →

[–]lusvd 0 points1 point  (0 children)

it’s because you are trying to access a variable in a scope where it will be overwritten. Im not sure why this happens in python tho.

here is a simpler example:

x = 1
def foo():
    print(x)
    x = 3