I had some very interesting results with this code to do what is asked: for key in globals().keys(): del globals()[key] for key in locals().keys(): del locals()[key]
It might be better to reverse the two steps, I didn't give it much thought. Anyway, when this is done, all of the builtins spill into globals and locals (since __builtin__ was deleted). I thought that was interesting. It did have the effect that is asked for, although there may be more unintended consequences. Also if any objects are attached to any of the builtins I expect they will still be around.
-- http://mail.python.org/mailman/listinfo/python-list