list index()

Carsten Haese carsten at uniqsys.com
Fri Aug 31 13:35:52 CEST 2007


On Thu, 30 Aug 2007 21:33:43 -0700, TheFlyingDutchman wrote
> On Aug 30, 9:06 pm, "Carsten Haese" <cars... at uniqsys.com> wrote:
> > On Thu, 30 Aug 2007 20:17:00 -0700, zzbbaadd wrote
> >
> > > Well IN was what I was looking for and would have saved this thread.
> > > However I don't believe IN showed up on the doc web page that has
> > > list methods, where I found index().
> >
> > They're not on the exact same page, but index() is in section 3.6.4 of the
> > library reference (http://docs.python.org/lib/typesseq-mutable.html), whereas
> > "in" is in section 3.6 of the library reference
> > (http://docs.python.org/lib/typesseq.html). I'm wondering how you managed to
> > find subsection 3.6.4 without finding section 3.6.
> 
> www.google.com
> 
> search "python list methods"
> 
> first search find:
> 
> 5. Data Structures
> The list methods make it very easy to use a list as a stack, where 
> the last element added .... Another useful data type built into 
> Python is the dictionary. ... http://docs.python.org/tut/node7.html
> 
> "The list data type has some more methods. Here are all of the 
> methods of list objects:"

Fair enough, but that's a tutorial. It would be foolish to demand that a
tutorial be a complete reference for everything that can be done with a list.
The page lists all methods of list objects, but there are more things one can
do with lists that don't look like method calls. For example, it doesn't say
that you can compare lists. It doesn't say that you can read and write
elements in the lists. Would you automatically assume that those things aren't
possible? I hope not. (Of course, those operations are handled by the magical
methods __eq__, __setitem__, __getitem__ etc, but I think one can forgive the
tutorial for not mentioning those in the interest of not confusing beginners.)

By your logic, no web page would be allowed to say anything about lists unless
it says *everything* about lists, and that wouldn't be very useful.

--
Carsten Haese
http://informixdb.sourceforge.net




More information about the Python-list mailing list