[Tutor] Reset function
Christopher Smith
csmith@blakeschool.org
Wed, 08 Aug 2001 12:27:32 -0500
Dear tutor,
I looked at the reset function presented recently to "purify the namespace"
before running a program (reset(vars())) and the last line has me stumped.
Here's a simplified version:
###
def reset(namespace, user_safe_items=()):
for item in namespace.keys():
exec "del "+item in namespace
###
I thought something like "del item";
or "del namespace[item]" might work (they don't).
What is the "item in namespace" doing?? Namespace isn't a sequence
so why does this even work?
Any help appreciated.
/c