clear memory? how?

Ben C spamspam at spam.eggs
Tue May 9 20:22:37 CEST 2006


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:]) != ("__", "__")]



More information about the Python-list mailing list