preferred syntax for list extend?

Ian Bicking ianb at colorstudy.com
Wed Apr 17 16:00:16 EDT 2002


On Wed, 2002-04-17 at 14:51, Andrew Dalke wrote:
> 
> Ian Bicking:
> >+= is different from .extend()... for instance:
> >
> >q1 = [1, 2, 3]
> >q2 = q1
> >q3 = [4, 5, 6]
> >
> >q1 += q3   # then...
> >q2 == [1, 2, 3]
> 
> Really?

No, not really, you're right.

But that's weird...

q1 += q3
is not equivalent to:
q1 = q1 + q3

  Ian







More information about the Python-list mailing list