clear memory? how?

Grégoire Dooms doomsAinfoDuclDacDbe at AisATandDisDOT.com
Wed May 10 14:29:50 CEST 2006


Ben C wrote:
> On 2006-05-09, Ben C <spamspam at spam.eggs> wrote:
>> def clearall():
>>     all = [var for var in globals() if "__" not in (var[:2], var[-2:])]
>>     for var in all:
>>         del globals()[var]
>>
>> since I think magic things always start and end with __.
> 
> Oops, got that wrong anyway:
> 
> should be:
> 
>     all = [var for var in globals() if (var[:2], var[-2:]) != ("__", "__")]

You can also add
and var != "clearall"

:-)

--
Grégoire




More information about the Python-list mailing list