On Wed, Sep 9, 2009 at 10:00 PM, s7v7nislands<s7v7nisla...@gmail.com> wrote: <snip? > I known index() does not modify the sequence itself. my question is so > why the doc put the index() method in the mutable sequence types list?
Ah, okay. Now I understand your question. I don't know really. I suppose it could just as well go under the more general table for "6.6. Sequence Types". I'd guess it's under Mutable Sequence Types for convenience's sake since .remove() is mutable-only and makes reference to the same footnote. You could file a documentation bug: http://bugs.python.org <snip> > When a negative index is passed as the second or third parameter to > the index() method, the list length is added, as for slice indices. > I don't understand the mean. the list length is added, why? if it > changed, the original will change ? This feature just lets you use negative list indices, just like with slicing. For example: x = ["a", "b", "c", "d"] assert x[-1] == x[len(x) - 1] == x[3] == "d" assert x[-2] == x[len(x) - 2] == x[2] == "c" assert x[-3] == x[len(x) - 3] == x[1] == "b" assert x[-4] == x[len(x) - 4] == x[0] == "a" See also tec's examples. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list