Doug Holton <[EMAIL PROTECTED]> writes:

> Steven Bethard wrote:
> > Simo Melenius wrote:
> >> map (def x:

Oops, I found a typo alreay. I meant to write "def (x):" -- no name
for anonymous functions but just the argument list, please :)

> Right the comma plus other things make this difficult for a parser to
> handle correctly.  Other people have already come up with working

It is difficult since in Python we don't enjoy the ugly luxury of
stuffing statements inside {}s. But as Bengt pointed out, parentheses
don't actually look bad at all in this case.

> Then the multi-line way.  I had to add an overload of map to support
> reversing the order of parameters (list first, then the closure):
> 
> newlist = map([1,2,3,4,5,6]) def (x as int):
>       return x*x*x

That doesn't seem to scale if you want to pass more than one anonymous
function arguments to the function or call an arbitrary function with
parameters in arbitrary order.


br,
S
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to