Johnny Lin <[EMAIL PROTECTED]> wrote: ... > my understanding about locals() from the nutshell book was that i > should treat that dictionary as read-only. is it safe to use it to > delete entries?
Speaking as the Nutshell author: it's "safe", it just doesn't DO anything. I _hoped_ locals() would become a dictionary-proxy giving at least some *warning* about futile attempts to modify things through it, on the basis of "errors shouldn't pass silently", but it just didn't happen (yet). Nevertheless, any modifications to locals() are utterly futile (within a function). Unfortunately, I believe the only way to "delete locals" automatically as you desire is through exec statements (which will inevitably turn off the normal optimizations and make the whole function unbearably slow). I also suspect this won't help you one bit in tracking down your leaks. I would rather suggest you look into module gc... Alex -- http://mail.python.org/mailman/listinfo/python-list