Closures in Python capture variables, not values
This prints
The reason is that the argument is only evaluated when the function is executed.
The way to workaround this is to set it as a default value ("the default-value hack"):
Last updated
Was this helpful?