I wish that [].append(x) returned [x]
Michael Bentley
michael at jedimindworks.com
Tue May 1 17:14:20 EDT 2007
On May 1, 2007, at 3:45 PM, Tobiah wrote:
> I wanted to do:
>
> query = "query text" % tuple()
>
> but the append() method returns none, so I did this:
>
> fields = rec[1:-1]
> fields.append(extra)
> query = "query text" % tuple(fields)
>
As you learned. .append() adds to an existing list rather than
returning a new list. You might be happier with:
query = "query text" % tuple(rec[1:-1] + [extra])
More information about the Python-list
mailing list