A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-April/034577.html below:

[Python-Dev] Garbage collecting closures

[Python-Dev] Garbage collecting closuresPaul Prescod paul@prescod.net
Mon, 14 Apr 2003 07:34:22 -0700
Tim Peters wrote:
> ...
> 
> Hiding critical resources in closures is a Bad Idea, of course -- that's why
> nobody has used Scheme since 1993 <wink>

Just to be clear, I didn't really intend to create a closure (i.e. a 
package of code and data). I just defined a function in a function 
because the inner function wasn't needed elsewhere.

I don't know what the solution is, but it seems quite serious to me that 
  there is another special case to remember when reasoning about when 
destructors get called. Roughly, Python's cleanup model is "things get 
destroyed when nothing refers to them." Then, that gets clarified to 
"unless they have reference cycles, in which case they may get destroyed 
arbitrarily later" and now "or they are used in a function containing 
another function, which will cause a circular reference involving all 
local variables."

  Paul Prescod




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4