Why doesn't python's list append() method return the list itself?

dhruvbird dhruvbird at gmail.com
Mon Jul 12 06:10:34 EDT 2010


On Jul 12, 5:30 am, News123 <news1... at free.fr> wrote:
> dhruvbird wrote:
>
> > On a side note, is there any other way to append to a list using
> > slices (apart from the one below):
> > x[len(x):len(x)] = [item to append]
>
> dy you mean
> x.extend([1,2,3])

No, I meant x.append(4)
Except that I want to accomplish it using slices.

(I can do it as x[lex(x):] = [item_to_append] but is there any other
way?)

Regards,
-Dhruv.



More information about the Python-list mailing list