Re: Extending Python Syntax with @
claird@lairds.c om (Cameron Laird) writes:
[color=blue]
>Part of tribal lore--a true,
>documented part, by the way--is that Big Cheese Guido depre-
>cates lambdas. He says they're a mistake, and people shouldn't
>be using 'em.[/color]
Interesting! I had assumed lambdas to be a necessity. I rarely
used them until I learned Scheme, but I didn't realize there was
a clean alternative.
[color=blue]
>Whenever you feel like a lambda, define a named
>function;[/color]
How do you cleanly do that?
foo = range(-10, 10)
my_op = lambda x: float(x) / max(map(abs, foo))
bar = map(my_op, foo)
--kyler
claird@lairds.c om (Cameron Laird) writes:
[color=blue]
>Part of tribal lore--a true,
>documented part, by the way--is that Big Cheese Guido depre-
>cates lambdas. He says they're a mistake, and people shouldn't
>be using 'em.[/color]
Interesting! I had assumed lambdas to be a necessity. I rarely
used them until I learned Scheme, but I didn't realize there was
a clean alternative.
[color=blue]
>Whenever you feel like a lambda, define a named
>function;[/color]
How do you cleanly do that?
foo = range(-10, 10)
my_op = lambda x: float(x) / max(map(abs, foo))
bar = map(my_op, foo)
--kyler
Comment