[Python-3000] Possible alternative lambda syntax?

tomer filiba tomerfiliba at gmail.com
Sat Jan 13 16:07:04 CET 2007


[Adam Atlas]
> Imagine this as the syntax: (a, b: a+b)

i tend to like this feature. i'm either +0 or +1, i can't decide at the moment.
i always found lambda to be cumbersome and verbose. but i'm strictly -1
on having meaningful whitespace inside parenthesis, as your other
idea suggested.

when i try to think of it in practice (as i use lambdas in construct),
it looks like too many parenthesis too me:

Struct("foo",
    UBInt8("length"),
    Field("value", (ctx: ctx.length))
)

maybe omit the parenthesis at all?
Field("value", ctx: ctx.length)

you would only need parenthesis when you have multiple
arguments, i.e.

Field("foo", (a, b): a + b)

but then again, it's not too consistent either :-/

i guess the lambda grammar really is as good as it gets.


-tomer


More information about the Python-3000 mailing list