En Thu, 07 Feb 2008 20:13:00 -0200, Raymond Hettinger <[EMAIL PROTECTED]> escribió:
> On Feb 7, 1:57 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: >> Tuples are worse: they implement >> __contains__ but not index. So you can say: >> >> py> 2 in (1,2,4,8) >> True >> >> but not: >> >> py> (1,2,4,8).index(2) > > You must be using an old version of Python like 2.5 ;-) > > As of yesterday, Py2.6 has tuple.index() and tuple.count(). > > Python 2.6a0 (trunk:60638M, Feb 6 2008, 18:10:45) > [GCC 4.1.1 (Gentoo 4.1.1)] on linux2 > >>> (1,2,4,8).index(2) > 1 The Time Machine in action again! -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list