Newbie: tuple list confusion.
George Yoshida
ml at dynkin.com
Sun Sep 12 22:17:22 EDT 2004
Q852913745 wrote:
> My book states that a=a+b and a+=b are the same, and that different 'types' of
> sequence cannot be joined together.
This is because list's += is implemented to work like list's extend
method. Change "a += b" with "a.extend(b)". You get the same result. It
might be counterintuitive, but it is the way '+=' is implemented.
I'll add two pointers. Check them.
* Concatenating a tuple to a list
http://www.python.org/sf/575536
* list += string??
http://mail.python.org/pipermail/python-dev/2004-August/048389.html
- george
More information about the Python-list
mailing list