foo = 1Source: http://www.python.org/dev/peps/pep-0308/
A = 'A'
B = 'B'
C = 'C'
x = A if foo > 0 else B
# A
x = lambda: A if foo < 0 else B
x()
# B
x = A if not foo else B if foo < 0 else C
# C
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment