On Wed, 2007-10-17 at 20:27 +0000, Debajit Adhikary wrote: > I have two lists: > > a = [1, 2, 3] > b = [4, 5, 6] > > What I'd like to do is append all of the elements of b at the end of > a, so that a looks like: > > a = [1, 2, 3, 4, 5, 6] > > I can do this using > > map(a.append, b) > > How do I do this using a list comprehension?
You don't. > (In general, is using a list comprehension preferable (or more > "pythonic") as opposed to using map / filter etc.?) In general, a list comprehension is more Pythonic nowadays, but in your particular case the answer is neither map nor a list comprehension, it's this: a += b HTH, -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list