[Python-Dev] Extended Function syntax

Alex Martelli aleax@aleax.it
Sun, 2 Feb 2003 23:17:43 +0100


On Sunday 02 February 2003 11:07 pm, Brett Cannon wrote:
   ...
> Now if ``__exit__()`` would be executed regardless of exceptions this
> would probably eliminate a decent chunk of code that uses ``finally:``

Hmmm, yes, I _was_ sort of assuming that __exit__ runs much
like 'finally' would -- otherwise cleanup/release code would more
often than not have to be duplicated.

> 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.  =)

I think THAT is the complicated part of the "do" syntax -- that trailing
"(whatever):" that I don't understand.  What would its pluses be?
Where would that 'whatever' be directed to...?  Could you please
provide a use case for with + "(some_argument):" ...?


Alex