tag:blogger.com,1999:blog-21332048.post2513445397510311902..comments2023-08-24T09:22:20.836-04:00Comments on Developing Upwards: How to Add Memory Leaks to PythonCalvin Spealmanhttp://www.blogger.com/profile/07161631946662126734noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-21332048.post-36755798631494303092007-09-14T13:13:00.000-04:002007-09-14T13:13:00.000-04:00Of course, if your code raises an exception at the...Of course, if your code raises an exception at the global level, you're going to have other problems besides the left-over list...PJEhttps://www.blogger.com/profile/04688223805457202941noreply@blogger.comtag:blogger.com,1999:blog-21332048.post-5743320008843829872007-09-14T12:41:00.000-04:002007-09-14T12:41:00.000-04:00"_" in the interactive interpreter is completely d..."_" in the interactive interpreter is completely different than "_[1]" in globals<BR/><BR/><pre><BR/><BR/> Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)]<BR/> IPython 0.8.0 -- An enhanced Interactive Python.<BR/> <BR/> In [1]: def f():<BR/> ...: for i in xrange(10):<BR/> ...: yield i<BR/> ...: raise Exception("oh no!")<BR/> ...:<BR/> <BR/> In [2]: [x for x in f()]<BR/> ---------------------------------------------------------------------------<BR/> <type 'exceptions.Exception'> Traceback (most recent call last)<BR/> ...<BR/> <type 'exceptions.Exception'>: oh no!<BR/> <BR/> In [3]: 5<BR/> Out[3]: 5<BR/> <BR/> In [4]: _<BR/> Out[4]: 5<BR/> <BR/> In [5]: globals()['_[1]']<BR/> Out[5]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]<BR/><BR/></pre>manuel moe ghttps://www.blogger.com/profile/04878149837118503541noreply@blogger.comtag:blogger.com,1999:blog-21332048.post-34683578613699465202007-09-14T11:54:00.000-04:002007-09-14T11:54:00.000-04:00Doesn't '_' only exist in the interactive interpre...Doesn't '_' only exist in the interactive interpreter?Kevin Dangoorhttps://www.blogger.com/profile/13682774192456462795noreply@blogger.com