[Python-Dev] About block statement name alternative
Luis P Caamano
lcaamano at gmail.com
Fri Apr 29 16:43:34 CEST 2005
How about "bracket" or "bracket_with"? As in:
bracket_with synchronized(lock):
BLOCK
bracket_with opening("/etc/passwd") as f:
for line in f:
print line.rstrip()
bracket_with transactional(db):
db.store()
bracket_with auto_retry(3, IOError):
f = urllib.urlopen("http://python.org/peps/pep-0340.html")
print f.read()
block_with synchronized_opening("/etc/passwd", myLock) as f:
for line in f:
print line.rstrip()
def synchronized_opening(lock, filename, mode="r"):
bracket_with synchronized(lock):
bracket_with opening(filename) as f:
yield f
bracket_with synchronized_opening("/etc/passwd", myLock) as f:
for line in f:
print line.rstrip()
Or for that matter, "block_with", as in:
block_with transactional(db):
db.store()
--
Luis P Caamano
Atlanta, GA USA
More information about the Python-Dev
mailing list