
Sept. 22, 2005
8:26 p.m.
Andrea Riciputi wrote:
On Sep 22, 2005, at 9:33 PM, Alan G Isaac wrote:
def f(x): return x<=a and f1(x) or f2(x)
I've already tried something like this, but it doesn't work
I wish people would stop suggesting the 'a and b or c' trick, because it DOESN'T WORK except in special circumstances (i.e. when you can be sure that b is never false). What you want is: def f(x): if x <= a: return f1(x) else: return f2(x) -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg.ewing@canterbury.ac.nz +--------------------------------------+