[DB-SIG] pyformat Parameter Style
mal at lemburg.com
Wed May 14 17:36:14 EDT 2003
Chris Cogdon wrote:
> The ONLY valid solution I see is to very specifically state that
> pyformat allows %s and %(keyname)s, and nothing else, which is what many
> API's already do; they don't specifically check for %non-s, but it
> doesn't work, because the parameters are already strings by the time it
> gets to the python % operator (see code snippets previous in this thread).
I don't think the DB API should limit the authors in coming up
with good uses of the various Python format codes. How they
implement these is really up to the module author:
%s could mean: "bind as string" while %i means: "bind as integer".
%r could have the meaning: "bind as blob". You could even add new
parameters for e.g. date, datetime and time. etc. etc.
> The docs also imply that 'format' is for '%s' and 'pyformat' is for
> '%(keyname)s', but many APIs (eg, pyPgSQL) allow both, and intelligently
Which perfectly valid. Making the DB API docs more specific wouldn't
save you from reading the DB API module docs ;-)
Porting from one module to another is work nomatter how you put it.
Most of it goes into rewriting the SQL because that's what's causing
most of the trouble. The next big issue is that of differing data
Professional Python Software directly from the Source (#1, May 14 2003)
>>> Python/Zope Products & Consulting ... http://www.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
EuroPython 2003, Charleroi, Belgium: 41 days left
More information about the DB-SIG