[Python-Dev] Re: PEP 340 - possible new name for block-statement
André Roberge
andre.roberge at gmail.com
Fri Apr 29 22:10:57 CEST 2005
Robin Munn wrote:
[snip]
>
> Another possibility just occurred to me. How about "using"?
>
> ~ using EXPR as VAR:
> ~ BLOCK
>
Examples from PEP 340:
==========
def synchronized(lock):
...
using synchronized(myLock):
...
===== (+0)
def opening(filename, mode="r"):
...
using opening("/etc/passwd") as f:
...
===== (+1)
def auto_retry(n=3, exc=Exception):
...
using auto_retry(3, IOError):
...
===== (+1)
def synchronized_opening(lock, filename, mode="r"):
...
using synchronized_opening("/etc/passwd", myLock) as f:
...
===== (+1)
A.R.
More information about the Python-Dev
mailing list