SmokingDog wrote:
> Interesting interpretation.. but I just gave it a try.
>
>>>> a = (1,2,3,4)
>>>> a
> (1, 2, 3, 4)
>>>> a.index(3)
> 2
>>>> a.index(5)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ValueError: tuple.index(x): x not in tuple
>
> So my Python is saying that tuples do implement .index() method. What
gives?
>
> Or maybe the diveintopython version he's quoting is out of date?
Apparently...or something stranger.
The OP did not indicate version, which posters should always do.
methods were added to tuples in 3.0 and perhaps 2.6.
--
http://mail.python.org/mailman/listinfo/python-list