Use cases for del

Daniel Dittmar daniel.dittmar at sap.corp
Wed Jul 6 10:12:46 EDT 2005


Peter Hansen wrote:
> Arguing the case for del: how would I, in doing automated testing, 
> ensure that I've returned everything to a "clean" starting point in all 
> cases if I can't delete variables?  Sometimes a global is the simplest 
> way to do something... how do I delete a global if not with "del"?

globals ().__delitem__ (varname)

except that the method would probably be called delete.

Daniel



More information about the Python-list mailing list