Extending Python Syntax with @

Kyler Laird Kyler at news.Lairds.org
Thu Mar 11 15:09:47 CET 2004


claird at lairds.com (Cameron Laird) writes:

>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.  

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.

>Whenever you feel like a lambda, define a named
>function; 

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



More information about the Python-list mailing list