On Sat, Jun 5, 2010 at 4:52 PM, Stephen Hansen <apt.shan...@gmail.com>wrote:

>
>     cur.execute(sql, [pkg, prodid, tmpTable, quantity] +
> list(option_values))
>
> Or:
>
>    cur.execute(sql, (pkg, prodid, tmpTable, quantity) + option_values)
>
> I removed the explicit conversion-to-tuple in the first, because... you
> don't need to. Execute takes a sequence. It doesn't have to be a tuple. A
> list is fine. In the second one, I just build my first arguments as a tuple
> instead of as a list, and then add option_values to it... You'll just have
> to go up top and do:
>
>     option_values = ()
>
> In both places where you currently use []. As you can't add a list to a
> tuple anymore then a tuple to a list, for the same reasons.
>

Thanks. I always get tripped up on lists and tuples. In fact, just now I
decided to look up the difference again, it's so slight. At any rate, I
deliberately checked my variables using isinstance() and they all checked
out as tuples, so that's why I couldn't figure out where the list was!
Thanks again,
beno
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to