Equivalent to (a ? b : c) ?

Charles G Waldman cgw at fnal.gov
Tue Dec 21 12:53:27 EST 1999


How about this variation?

    eval({1:"a_expr(args)", 0:"b_expr(args)"}[not not c])


(Posted for entertainment value only,  I've never actually used
anything like this in real code)









More information about the Python-list mailing list