A friendlier, sugarier lambda -- a proposal for Ruby-like blocks in python
Alexey Borzenkov
snaury at gmail.com
Sat Oct 14 20:25:01 EDT 2006
bearophileHUGS at lycos.com wrote:
> but maybe it reduces code readabilty a bit for people
> that have just started to program:
>
> mul2 = def(a, b):
> return a * b
>
> Instead of:
>
> def mul2(a, b):
> return a * b
For such simple cases, yes. What about:
button.click += def(obj):
# do stuff
You obviously can't:
def button.click(obj):
# do stuff
:-) And if you make intermediate function and then assign it somewhere,
it "pollutes namespace": it's still left there, unneeded.
More information about the Python-list
mailing list