Tertiary Operation

abcd codecraig at gmail.com
Tue Oct 17 15:51:57 CEST 2006


Carsten Haese wrote:
> Use Python 2.5 where there is a true conditional
> expression or find another way to solve your problem.

python 2.5 once we upgrade (hopefully soon), anyways...an earlier post
suggested the inverse...

x = None
result = (x is not None and str(x) or "")

which works just fine.

thanks.




More information about the Python-list mailing list