LWN.net Logo

PyCon: Evangelizing Python

PyCon: Evangelizing Python

Posted Mar 27, 2013 19:03 UTC (Wed) by kjp (subscriber, #39639)
Parent article: PyCon: Evangelizing Python

As much as I love python I have to disagree about one item in that list: the DB-API. It has 5(!) different parameter quoting methods that drivers may use, and it uses an insane default (a select statement starts a transaction instead of being in autocommit, and that has unfortunately also infected sqlalchemy). That last part [unintended long transactions] can wreak havoc on a MVCC database.

Exceptions are also great (cough cough GO), and the exception hierarchy in 3.x looks really good, although I haven't used 3.x yet. The async io and coroutines planned for 3.4 (yield from) also look really nice.

Also: never use import *, use pyflakes, be intentional about choosing function and module names so you can grep for them later, and life should be good :-)


(Log in to post comments)

DB-API

Posted Mar 28, 2013 16:07 UTC (Thu) by smurf (subscriber, #17840) [Link]

I have to second your gripe about the DB-API. It's fundamentally non-Pythonic in other way, too: I would like to write

    import Db
    db = Db.connect(whatever)

    for x,y in db.select("select x,y from foo where bar=${baz}", baz=123):
        do_something(x,y)

In fact I wonder how many people, besides me ( see sqlmix on github ) wrote their own wrapper for the stuff?

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds