Further adventures in array slicing.
John Machin
sjmachin at lexicon.net
Fri May 4 18:43:39 EDT 2007
On May 5, 7:03 am, "Steven W. Orr" <ste... at syslang.net> wrote:
> This is more for my education and not so much for practicality.
>
[snip]
>
> A second question is: When can you use += vs .append(). Are the two always
> the same?
>
Formally, they can never be the same. They can be used to produce the
same result, in limited circumstances, e.g. these:
alist += bseq
and
alist.append(anelement)
will give the same result if bseq == [anelement]
You can use alist.extend(bseq) instead of alist += bseq
I suggest that you
(a) read the manual sections on each of the 3 possibilities
(b) explore their behaviours at the Python interactive prompt
More information about the Python-list
mailing list