a short-cut command for globals().clear() ??

CapnBearbossa at googlemail.com CapnBearbossa at googlemail.com
Mon Sep 22 17:31:24 EDT 2008


hi all,

forgive me , but the RTFM and Google search approaches are not
yielding an answer on this question.  I need to know if there's a top
level python interpreter command that clears all user variables (not
built-ins) from the global namespace.  In other words a statement, or
some_command_or_function(), that does this:

>>> x=3
>>> y=4
>>> z=[]
>>> dir()
['__builtins__', '__doc__', '__name__', 'x', 'y', 'z']

>>> some_command_or_function()

>>> dir()
['__builtins__', '__doc__', '__name__']

thanks,
   1 desperate snake oil programmer ....



More information about the Python-list mailing list