<div style="font-family:Verdana;font-size:14px;color:#000;"><DIV>the value 5 not in tuple </DIV><DIV>reference help</DIV><DIV> </DIV><DIV>list.index(x) </DIV><DIV>Return the index in the list of the first item whose value is x. It is an error if there is no such item.</DIV><div> </div><div><sign signid="0"><div style="color:#909090;font-family:Arial Narrow;font-size:12px">------------------</div><div style='font-size:14px;font-family:Verdana;color:#000;'><span class="Apple-style-span" style="background-color: rgb(255, 255, 255);">Eric Lee</span></div></sign></div><div><qzone signid=""></qzone></div><div><taotao signid=""></taotao></div><div> </div><div style="font:Verdana normal 14px;color:#000;"><div> </div><div> </div><div style="FONT-SIZE: 12px;FONT-FAMILY: Arial Narrow;padding:2px 0 2px 0;">------------------ 原始邮件 ------------------</div><div style="FONT-SIZE: 12px;"><div><b>发件人:</b> "Chris Rebert"<clp2@rebertia.com>;</div><div><b>发送时间:</b> 2009年10月15日(星期四) 下午4:48</div><div><b>收件人:</b> "Xavier Ho"<contact@xavierho.com>;</div><div><b>主题:</b> Re: () vs []</div></div><div> </div>On Thu, Oct 15, 2009 at 1:46 AM, Xavier Ho <contact@xavierho.com> wrote:<br>><br>> On Thu, Oct 15, 2009 at 6:39 PM, Chris Rebert <clp2@rebertia.com> wrote:<br>>><br>>> Nanjundi meant "index method" as in "a method .index()" (i.e. a method<br>>> named "index") which searches through the container for the given item<br>>> and returns the index of the first instance of said item, like<br>>> list.index() does.<br>>><br>> Interesting interpretation.. but I just gave it a try.<br>><br>>>>> a = (1,2,3,4)<br>>>>> a<br>> (1, 2, 3, 4)<br>>>>> a.index(3)<br>> 2<br>>>>> a.index(5)<br>> Traceback (most recent call last):<br>>  File "<stdin>", line 1, in <module><br>> ValueError: tuple.index(x): x not in tuple<br>><br>> So my Python is saying that tuples do implement .index() method. What gives?<br>><br>> Or maybe the diveintopython version he's quoting is out of date?<br><br>Apparently...or something stranger.<br><br>Cheers,<br>Chris<br>-- <br>http://mail.python.org/mailman/listinfo/python-list<br></div></div>