akfred
Re:Understanding a Python Closure Oddity
on Monday June 17, 2024 @09:24AM (#40705395)
> No. The code is completely consistent: the closures are different instances of a function that returns the value of 'number' at the moment it gets called. Not the value of 'number' when it gets created.
Isn't that exactly what GP said? And gave an example how to create that effect explicitly in functional languages, using refs?