John Hunter wrote: > >>>del locals()['x'] The locals() dictionary will only modify values in a module's top-level code (i.e. when the expression "locals() is globals()" is true).