Extending Python Syntax with @

Richie Hindle richie at entrian.com
Thu Mar 11 09:41:21 EST 2004


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

[Kyler]
> 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)

foo = range(-10, 10)
def my_op(x):
    return float(x) / max(map(abs, foo))
bar = map(my_op, foo)

...did I misunderstand?

-- 
Richie Hindle
richie at entrian.com





More information about the Python-list mailing list