I wish that [].append(x) returned [x]

Rob Wolfe rw at smsnet.pl
Tue May 1 16:58:39 EDT 2007


Tobiah <toby at tobiah.org> writes:

> I wanted to do:
>
> 	query = "query text" % tuple(rec[1:-1].append(extra))
>
> but the append() method returns none, so I did this:
>
> 	fields = rec[1:-1]
> 	fields.append(extra)
> 	query = "query text" % tuple(fields)

What about this?

 	query = "query text" % tuple(rec[1:-1] + [extra])

-- 
HTH,
Rob



More information about the Python-list mailing list