Thursday, December 13, 2012

Ternary in python

Example:
xxx = ..... something
msg = xxx if xxx  else  "hello world"

or better:
msg = xxx or "hello world"

No comments: