flat tuple

Alex Martelli aleaxit at yahoo.com
Tue Sep 21 09:26:37 EDT 2004


Phil Frost <indigo at bitglue.com> wrote:

> Tuples can be joined with the + operator, like so:
> 
> >>> (1,2)+(3,4)
> (1, 2, 3, 4)
> 
> so in your case, you could do (n,) + t. If you are using the result for
> % formatting, it might be better to use a list, which is mutable, so

Might be, but % wants a tuple as the RHS (assuming the LHS format string
has multiple %-formatting elements), NOT a list.


Alex



More information about the Python-list mailing list