News for hackers. Stuff that matters.
Re:Understanding a Python Closure Oddity by akfred 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?

Re:Understanding a Python Closure Oddity by mharig on Tuesday June 18, 2024 @08:39AM (#40717119)
Yes. But I found the explanations of the GP a little misleading, especially the eager/lazy part.