[Python-Dev] Extended Function syntax
Samuele Pedroni
pedronis@bluewin.ch
Sun, 2 Feb 2003 23:14:41 +0100
From: "Brett Cannon" <bac@OCF.Berkeley.EDU>
>
> Wouldn't this also allow one to code in a contract programming style ala
> Icon (assuming I remember correctly how contract programming works)? I
> mean you have control over the enter and exit of the thunk (would this
> still be called a thunk, or just syntactic sugar for calling
> ``__exit__()`` and ``__enter__()``; more like a thunk-ish protocol?) which
> is what I thought was the focus of contract programming.
>
> Either way this seems rather nice. And if you can pass in arguments (as I
> think ``FILE = file('blah.txt', 'rb'): (some_argument):`` is supposed to
> implement) this would be really nice. =)
no there is no first-class thunk here, this is really just sugar for a
try-finally. The point here is not to need first-class thunks!