the PHP ternary operator equivalent on Python

Luis M. Gonzalez luismgz at gmail.com
Wed Nov 23 10:21:18 EST 2005


This could be done easier this way:

L = [('even','odd')[n%2] for n in range(8)]




More information about the Python-list mailing list