>>>>> "Johnny" == Johnny Lin <[EMAIL PROTECTED]> writes:
Johnny> Hi! Is there a way to automate the unbinding of multiple Johnny> variables? Say I have a list of the names of all Johnny> variables in the current scope via dir(). Is there a Johnny> command using del or something like that that will iterate Johnny> the list and unbind each of the variables? Hi Johnny I assume you are the one and only Johnny Lin at the U of C, no? John-Hunters-Computer:~> python Python 2.3 (#1, Sep 13 2003, 00:49:11) [GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> x = 1 >>> y = 2 >>> locals() {'__builtins__': <module '__builtin__' (built-in)>, '__name__': '__main__', 'y': 2, '__doc__': None, 'x': 1} >>> print x,y 1 2 >>> del locals()['x'] >>> print x,y Traceback (most recent call last): File "<stdin>", line 1, in ? NameError: name 'x' is not defined >>> locals() {'__builtins__': <module '__builtin__' (built-in)>, '__name__': '__main__', 'y': 2, '__doc__': None} >>> -- http://mail.python.org/mailman/listinfo/python-list