Appending a list's elements to another list using a list comprehension

Robert Kern robert.kern at
Thu Oct 18 02:27:08 CEST 2007

Debajit Adhikary wrote:
> On Oct 17, 5:40 pm, Paul Hankin <paul.han... at> wrote:
>> To answer your question though: a += b is *not* the same as a = a + b.
>> The latter would create a new list and assign it to a, whereas a += b
>> updates a in-place.
> I know I'm being a little finicky here, but how would someone know
> that a+=b is not the same as a=a+b?
> Any documentation or reference that mentions this?

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

More information about the Python-list mailing list