On Wed, 09 Sep 2009 22:00:41 -0700, s7v7nislands wrote:
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
Chris Rebert wrote:
On Wed, Sep 9, 2009 at 10:00 PM, s7v7nislandss7v7nisla...@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?
Because once upon a time, only lists and not
hi all:
what is the s.index() mean? does the index() change the s?
In python2.6 doc (6.6.4. Mutable Sequence Types), Note 4:
Raises ValueError when x is not found in s. When a negative index is
passed as the second or third parameter to the index() method, the
list length is added, as for
On Sep 9, 11:00 pm, s7v7nislands s7v7nisla...@gmail.com wrote:
hi all:
what is the s.index() mean? does the index() change the s?
In python2.6 doc (6.6.4. Mutable Sequence Types), Note 4:
Raises ValueError when x is not found in s. When a negative index is
passed as the second or
On Wed, Sep 9, 2009 at 9:00 PM, s7v7nislandss7v7nisla...@gmail.com wrote:
hi all:
what is the s.index() mean? does the index() change the s?
It tells you the index of the first instance of the given element in
the sequence. Or, to quote the docs:
s.index(x[, i[, j]]) --- return smallest
On Wed, 09 Sep 2009 21:00:20 -0700, s7v7nislands wrote:
hi all:
what is the s.index() mean? does the index() change the s?
It returns the index (position) of its argument in the object s. Have you
tried it to see for yourself?
['a', 'b', 'c', 'd'].index('c') # 'c' is in position 2
2
Thanks for your reply! Sorry for my poor english!
On Sep 10, 12:33 pm, Chris Rebert c...@rebertia.com wrote:
On Wed, Sep 9, 2009 at 9:00 PM, s7v7nislandss7v7nisla...@gmail.com wrote:
hi all:
what is the s.index() mean? does the index() change the s?
It tells you the index of the first
s7v7nislands 写道:
Thanks for your reply! Sorry for my poor english!
On Sep 10, 12:33 pm, Chris Rebert c...@rebertia.com wrote:
On Wed, Sep 9, 2009 at 9:00 PM, s7v7nislandss7v7nisla...@gmail.com wrote:
hi all:
what is the s.index() mean? does the index() change the s?
It tells you the index
On Wed, Sep 9, 2009 at 10:00 PM, s7v7nislandss7v7nisla...@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