3 ms·
> In pre Python 3, the closed over value isn't mutable unless it's a reference to a mutable object. > Proper closures were added in Python 2.2 (which is quite o
by irahul 15y ago
> In pre Python 3, the closed over value isn't mutable unless it's a reference to a mutable object.
> Proper closures were added in Python 2.2 (which is quite old at this point), not Python 3.
x is a reference to a mutable object(list), and it's not x which is mutated but what x refers to. Pre python 3 doesn't have proper closures - ways to emulate it, yes. Proper closures - no.