programming logical functions: myand, myor and mynot

Fernando Pérez fperez528 at yahoo.com
Sun Nov 18 08:53:02 EST 2001


Jeff Shannon wrote:
 
> Or, alternatively
> 
> import operator
> 
> def bool(x):
>     return operator.truth(x)

simpler:

bool = operator.truth

More pythonic, more efficient (one less function call).

cheers,

f



More information about the Python-list mailing list