Execution of import (was Re: boolean xor)

Peter Hansen peter at engcorp.com
Sun Jan 7 22:26:25 EST 2001


Fredrik Lundh wrote:
> 
> Aahz Maruch wrote:
> > I need a boolean (not bit-wise) xor function.  I've got the following
> 
> def xor(a,b):
>     from operator import truth
>     return truth(a) ^ truth(b)

An aside: does the 'from .. import' statement 
execute every time the function 'xor'
is called, or only during the execution 
of the 'def' statement?



More information about the Python-list mailing list