At 12:32 14.04.03 -0700, Paul Prescod wrote: >Buggy: > >def b(): > def a(): > if something: > a() > a() > # ten thousand lines of code > junk = com_object.do_something() a should refer and close over junk otherwise nothing bad happens. >>> class X: ... def __del__(self): ... print "dying" ... >>> def b(x): ... def a(n): ... if n: a(n-1) ... a(1) ... junk = x ... >>> b(X()) dying vs. >>> def b(x): ... def a(n): ... if n: a(n-1) ... junk ... junk = x ... >>> b(X()) >>> gc.collect() dying 10 regards
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