[Python-Dev] thunks
Samuele Pedroni
pedronis@bluewin.ch
Tue, 4 Feb 2003 04:07:56 +0100
From: "Guido van Rossum" <guido@python.org>
>
> Thunk blending in:
>
> [<variable> =] <expression>:
> <block>
>
these need use cases that go beyond what 'with' can do.
If multiple execution of the thunk is allowed and control over break, one usage
would be:
loop:
<block> # can contain break/continue
instead of:
while 1:
<block>
Another, if in a program one uses often the if some_cond, e.g.
if ctl.mode == INTERACTIVE:
<block>
if ctl.mode != INTERACTIVE:
<block>
one could define:
interactive:
<block>
notinteractive:
<block>
...