On Fri, May 17, 2013 at 5:39 PM, Michael Bayer <mike...@zzzcomputing.com> wrote: > > On May 17, 2013, at 11:50 AM, Daniele Varrazzo <daniele.varra...@gmail.com> > wrote: > >> >> If that's too provocative I think the Python dbapi should mandate the >> %s and %(name)s formats because they are the only ones to have well >> defined syntax and escaping rule and are well known to every python >> developer. > > I forgot also, not to mention that Python itself is moving away from "%" as a > formatting operator, in favor of the newer .format() method which has yet > *another* syntax: see pep 3101: > > http://www.python.org/dev/peps/pep-3101/ > > http://docs.python.org/3/library/string.html#formatspec > > I love the format and pyformat styles a lot for Python programming but I feel > like they cause a lot of confusion when they are additionally interpreted by > a DBAPI. It runs you into various "double-escaping" types of situations.
I purposely avoided calling format() in cause as a suggestion to move there. The one supported by format() is to allow richness in the way the values are merged to the format string, whereas for the dbapi the driver knows better than the user. For example the driver only needs support for %s, not for %d or for %0.2f. -- Daniele _______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig