Equivalent to (a ? b : c) ?

Amit Patel amitp at Xenon.Stanford.EDU
Wed Dec 22 16:44:03 EST 1999


 Charles G Waldman  <cgw at fnal.gov> wrote:
| 
| How about this variation?
| 
|     eval({1:"a_expr(args)", 0:"b_expr(args)"}[not not c])
| 

Shortens to:

eval(["b_expr(args)", "a_expr(args)"][not c])

		      ;-)

		      Amit




More information about the Python-list mailing list