On 2006-05-10, Gr�goire Dooms <[EMAIL PROTECTED]> wrote:
> Ben C wrote:
>> On 2006-05-09, Ben C <[EMAIL PROTECTED]> 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"
>
>:-)
Good point :)
I've heard of "write once run anywhere", but this is "run once".
--
http://mail.python.org/mailman/listinfo/python-list