A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-April/053139.html below:

[Python-Dev] About block statement name alternative

[Python-Dev] About block statement name alternative [Python-Dev] About block statement name alternativeLuis 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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4