[Python-ideas] Ruby-style Blocks in Python Idea (alternative)
spir
denis.spir at free.fr
Tue Mar 10 09:58:22 CET 2009
Le Tue, 10 Mar 2009 01:13:42 +0100,
Jan Kanis <jan.kanis at phil.uu.nl> s'exprima ainsi:
> This being python-ideas, I'll also have a go at it.
>
> Being someone who does like functional programing when used in limited
> quantities, I also think multi line lambdas (or blocks, whatever you
> call them) are a good thing if a good way could be found to embed them
> into Python. But I don't like the part of tavs proposal of handling
> them with a magic __do__ function. So what about this slightly
> modified syntax and semantics:
>
> def NAME(ARGS) [as OTHERNAME] with EXPRESSION_CONTAINING_NAME:
> BODY
>
> eg:
>
> def callback(param) as result with do_something(with_our(callback),
> other, args):
> print("called back with "+param)
> return foobar(param)
I like this proposal much more than all previous ones.
Still, how would you (or anybody else) introduce the purpose, meaning, use of this construct, and its language-level semantics? [This is not disguised critics, neither rethoric question: I'm really interested in answers.]
Denis
------
la vita e estrany
More information about the Python-ideas
mailing list