On 6/22/07, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Thu, 2007-06-21 at 10:33 -0600, Anthony Tuininga wrote: > > I would like to suggest adding > > the syntactic sugar (*args, *kwargs) in order to avoid having to build > > the list, tuple or dictionary when passing arguments to the execute > > method. For backwards compatibility you can check the list of > > parameters and if the length is one and the first argument is a list, > > tuple or dictionary change the arguments to the new style on the fly. > > -1 > > As much as I'd like to be able to do this, I don't think this can be > done in a backwards compatible way that is guaranteed to do the right > thing in all cases. If the query has one placeholder and the parameter > is a one-element sequence, it is impossible to know for certain whether > the sequence itself or its only contained element should be bound as the > parameter.
I agree that this is possible but it is a low enough occurrence that it can be explicitly warned against -- backwards compatibility is not perfect but it is reasonable considering that the DB API doesn't even mention sequences (arrays) as possible parameter values; it only deals with scalar parameter values. > I think we should refuse the temptation to guess and go with the > established semantics. I suppose the other option is to come up with a new name for the new syntax. Taking a page from some of the other modules that Python has, perhaps cursor.executev(statement, *args, *kwargs) Maybe that is more palatable? > -- > Carsten Haese > http://informixdb.sourceforge.net > > > _______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig