Idiom for 'the lesser of the two'?

Chris Liechti cliechti at gmx.net
Fri Oct 18 16:02:34 EDT 2002


Gordon Airport <uce at ftc.gov> wrote in news:A6udnSqYRcfk-
C2gXTWcqA at comcast.com:

> There's got to be something simple I'm missing...
> You obviously can't do
> a < b ? a : b

(a<b) and a or b

or

((a<b) and [a] or [b])[0]

are usual. btw that's a FAQ:
http://www.python.org/cgi-bin/faqw.py?req=show&file=faq04.016.htp

but in you case it's better to use "min(a,b)" anyway ;-)

chris

-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list