mode == 1 ? TRUE : FALSE as a Lambda function

Pettersen, Bjorn S BjornPettersen at fairisaac.com
Tue Oct 21 20:50:06 EDT 2003


> From: dave [mailto:dfarning at localhost.localdomain] 
> 
> I recently started using python and am trying to create the 
> following four statements as Lambda Functions.
> 
> mode == 1 ? TRUE : FALSE
> mode == 2 ? TRUE : FALSE
> mode == 3 ? TRUE : FALSE
> mode == 4 ? TRUE : FALSE

the obvious answer is

  lambda: mode == 1

etc., so I'm assuming you're meaning something more
convoluted/complex/unspecified?

-- bjorn





More information about the Python-list mailing list