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/2000-April/003137.html below:

A surprising case of cyclic trash

[Python-Dev] Re: A surprising case of cyclic trash [Python-Dev] Re: A surprising case of cyclic trashNeil Schemenauer nascheme@enme.ucalgary.ca
Tue, 4 Apr 2000 23:19:45 -0600
An even simpler example:

>>> import sys
>>> d = {}
>>> print sys.getrefcount(d)
2
>>> exec("def f(): pass\n") in d
>>> print sys.getrefcount(d)
3
>>> d.clear()
>>> print sys.getrefcount(d)
2

exec adds the function to the dictionary.  The function
references the dictionary through globals.

    Neil

-- 
"If elected mayor, my first act will be to kill the whole lot of
you, and burn your town to cinders!" -- Groundskeeper Willie



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