On Tue, May 30, 2017 at 8:21 AM, Chris Angelico <ros...@gmail.com> wrote: > On Wed, May 31, 2017 at 12:12 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: >> There's no difference I'm aware of in the implementations I've used, >> but having a consistent API does allow for constructions such as: >> >> try: >> do_stuff(conn) >> except: >> conn.rollback() >> finally: >> conn.commit() >> >> without having to worry about variations in syntax between databases. > > I prefer: > > with conn, conn.cursor() as cur: > do_stuff(cur)
As do I, but it's not as clear what that does and the use as context managers is also not explicitly supported by PEP 249. -- https://mail.python.org/mailman/listinfo/python-list