On 20 Jan 2005 19:24:43 -0800, Johnny Lin <[EMAIL PROTECTED]> wrote:
> Hi!
> 
> Is there a way to automate the unbinding of multiple variables?  Say I
> have a list of the names of all variables in the current scope via
> dir().  Is there a command using del or something like that that will
> iterate the list and unbind each of the variables?
> 
> Thanks much!  (If anyone posts an answer, if you could also cc your
> reply to my email [EMAIL PROTECTED], would be much obliged.  Thanks
> again!)

My immediate reaction is "You never want to do that"

If you're doing something along these lines:

#some code
#create lots of variables
#do stuff with those variables
# <want to delete variables here
#more code

Try converting it to this idiom:

def someFunction(someinput)
  #create lots of variables
  #do stuff with those variables
  return output

#some code
output = someFunction(input)
#more code

Regards,
Stephen Thorne.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to