I'm very familiar with appending x to a list, s, using s.append(x), however, I've never understood what the docs mean by

s.append(x) same as s[len(s):len(s)] = [x]
(See <http://docs.python.org/lib/typesseq-mutable.html>)

Trying it,

>>> s = [1,2,3]
>>> x = 5
>>> s[len(s):len(s)] = [x]
>>> s[len(s):len(s)]
[]
>>>

I'm not enlightened. Just what do the docs mean?

Thanks,

Dick Moores

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to