On Mon, Apr 16, 2012 at 3:13 AM, Raymond Hettinger <[email protected]> wrote: > Instead, the context manager implements a different behavior. It would > have been better if that behavior had been given a name: > > db = sqlite3.connect(filename) > with auto_commit_or_rollback(db): > # do a transaction
I agree that it wants a name. If explicitness is the goal, would this be more suitable? db = sqlite3.connect(filename) with db.begin_transaction() as trans: # do a transaction This way, if a database engine supports multiple simultaneous transactions, the same syntax can be used. Chris Angelico _______________________________________________ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
