list index()

TheFlyingDutchman zzbbaadd at aol.com
Fri Aug 31 10:01:01 EDT 2007


>
> 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.

I wasn't demanding anything of the page. I was pointing out how I made
the assumption there was no way to find out if a list has a value
other than by using index(). I am not used to having keywords in a
language operate on a data structure, in addition to its methods.

> 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.

As I just stated, I wasn't making a criticism of the page. But since
you are defending it, let's talk about Python documentation from the
perspective of an experienced programmer who is a new/casual user of
both Python and Java. If I am in the process of writing a little Java
program, java.sun.com provides documentation on its data structures
that show up right at the top of a google search for "Java ArrayList",
"Java Hashtable", etc.

If I am writing a little Python program and want to see what I can do
with a list, I google "python list" I get the tutorial page that has
been mentioned. Then the next query result is a page that is titled
the "Python Language Reference". But in this reference page for
"python str,unicode,list,tuple,buffer,xrange", I see operators that
work on lists and other data structures that I an mot concerned with,
but there is no list of "list methods". But I do see navigational
arrows that I hopefully assume will take me to a page where I can find
all the list methods - but that is not the case. I go from "3.6
Sequence Types -- str, unicode, list, tuple, buffer, xrange" to "3.6.1
String Methods" to "3.6.2 String Formatting Operations" to "3.6.3
XRange Type" to "3.6.4 Mutable Sequence Types". And then I'm done with
3.6 of the Python Language Reference and I never saw a list of list
methods or a page devoted to lists. So I bounce out to the table of
contents assuming that there must be an entry for "list" that will
show all the list methods and operators and give me a summary ala Java
ArrayList. But all I find are entries for UserList and AddressList. :(




More information about the Python-list mailing list