Python Documentation — Fail!

One of many rants against python documentation.  Fundamentally, things like this only re-enforce why it didn’t receive the rapid acceptance of PHP.

$ pydoc list

| index(...)
| L.index(value, [start, [stop]]) -&gt; integer -- return first index of value</pre>

Ok, that’s good… But what about the “not found” case, is it documented, nope!  We have three choices, can you pick the right one?

  • Return None
  • Return -1
  • Throw an exception

So, what the documentation requires you to do is write three lines of code to understand how list.index() works.  This is fundamental failure of the maintainers of the language.