[Informixdb-cvs] informixdb/doc manual.txt,1.11,1.12
Brought to you by:
chaese,
f-apolloner
From: Carsten H. <ch...@us...> - 2006-09-28 01:26:04
|
Update of /cvsroot/informixdb/informixdb/doc In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv19242 Modified Files: manual.txt Log Message: Include documentation on 'with' block handling. Index: manual.txt =================================================================== RCS file: /cvsroot/informixdb/informixdb/doc/manual.txt,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** manual.txt 13 Sep 2006 03:28:47 -0000 1.11 --- manual.txt 28 Sep 2006 01:26:00 -0000 1.12 *************** *** 61,64 **** --- 61,83 ---- the connection to be closed or deallocated first). + `New in version 2.3`: Connections and cursors support the context management + protocol for Python 2.5 `with` blocks. This allows code like this:: + + conn = informixdb.connect(...) + try: + cur = conn.cursor() + try: + # do something with cur + finally: + cur.close() + finally: + conn.close() + + to be written in Python 2.5 more concisely as:: + + with informixdb.connect(...) as conn: + with conn.cursor() as cur: + # do something with cur + Executing SQL statements ======================== |