I give up... was: A = X > Y ? X : Y

Fredrik Lundh effbot at telia.com
Wed Feb 16 16:19:42 EST 2000


Andrew Csillag <drew.csillag at starmedia.net> wrote:
> > >> def  cStyleIIF(condition, iftrue, iffalse):
> > >>     if eval(condition):
> > >>         return eval(iftrue)
> > >>     else:
> > >>         return eval(iffalse)
> Even easier:
> >>> x = 5
> >>> y = 20
> >>> a = x<y and x or y # a ? b : c --> a and b or c
> >>> a
> 5

oh.  when we reach the end of a thread,
lets start from the beginning again... :-)

</F>





More information about the Python-list mailing list