[Python-ideas] Ruby-style Blocks in Python Idea

tav tav at espians.com
Mon Mar 9 18:15:13 CET 2009

Hey Steven,

> Can you explain why:
>   func(named_function)
> is radically different from:
>   func(multi-line-code-block-without-the-name)

Hmz, the intention isn't to support multi-line lambdas. It's to make
passing in anonymous functions easier.

For precedence let's take a look at decorators. Fundamentally,
decorators save a user nothing more than a single line of code.

Why do @foo, when you could just do: func = foo(func) ?

But saving developers that extra line of typing has obviously been
useful -- you can find decorators used pretty heavily in many of the
major Python frameworks nowadays...

By easing up some of the hassle, we can encourage certain forms of development.

love, tav

plex:espians/tav | tav at espians.com | +44 (0) 7809 569 369
http://tav.espians.com | http://twitter.com/tav | skype:tavespian

More information about the Python-ideas mailing list