O'Reilly logo
  • You Wang thinks this is interesting:

This doesn’t quite work, though—because the enclosing scope variable is looked up when the nested functions are later called, they all effectively remember the same value

From

Cover of Learning Python, 5th Edition

Note

for loop must use default argument to capture value in time