Code block function syntax, anonymous functions decorator

Arnaud Delobelle arnodel at googlemail.com
Fri Feb 8 02:08:54 EST 2008


On Feb 8, 6:50 am, castiro... at gmail.com wrote:
> Sometimes, it's more appropriate to write
>
> @call
> def f():
>    normal_suite()
>
> than
>
> def f():
>    normal_suite()
> f().
>
> It's clearer to the eye and reader, and truer to the meaning of the
> code.  From reading the docs, it's pretty clear that it's not what the
> author meant for decorators.  So, even though it's good and practical,
> as well as Pythonic, it doesn't get in.

As I remarked in a recent post, it's already almost in, but it's
called '@apply' (I don't know what your @call returns):

@apply
def the_answer(x=6):
    return x*(x+1)

print the_answer

:-)

--
Arnaud




More information about the Python-list mailing list