map (def x:
if foo (x):
return baz_1 (x)
elif bar (x):
return baz_2 (x)
else:
global hab
hab.append (x)
return baz_3 (hab),
[1,2,3,4,5,6])
I think this would probably have to be written as:
map (def x:
if foo(x):
return baz_1(x)
elif bar(x):
return baz_2(x)
else:
global hab
hab.append(x)
return baz_3(hab)
, [1,2,3,4,5,6])or:
map (def x:
if foo(x):
return baz_1(x)
elif bar(x):
return baz_2(x)
else:
global hab
hab.append(x)
return baz_3(hab)
,
[1,2,3,4,5,6])Note the placement of the comma. As it is,
return baz_3(hab),
returns the tuple containing the result of calling baz_3(hab):py> def f(x): ... return float(x), ... py> f(1) (1.0,)
It's not horrible to have to put the comma on the next line, but it isn't as pretty as your version that doesn't. Unfortunately, I don't think anyone's gonna want to revise the return statement syntax just to introduce anonymous functions.
Steve -- http://mail.python.org/mailman/listinfo/python-list
