[Python-3000] A plea for anonymous functions

Antoine solipsis at pitrou.net
Thu Nov 16 18:24:38 CET 2006


>> How is this one supposed to work ? What is "with async blah()" ?
>
> a magic thing that runs the code block behind the covers, of course.
> requires a
> non-released version of the from __future__ statement, at the time.

;-))

> unlike the
> following syntax:
>
> @server.get_synset_link()
> def block(response):
>     format_expanded(li.content, response.related)

Ok, that's nearly perfect!
Only "nearly" because:
1. There are cases where you want the return value of the
"get_synset_link". 2. You sometimes need more than one callback, and you
cannot decorate two functions at once. For example, with Twisted you can
define a callback (called on success) and an errback (called on error).

But I agree that decorators help to solve a lot of problems.

Thanks for the answer

Antoine.




More information about the Python-3000 mailing list