[Tutor] basic question ...

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Sat Oct 28 05:54:52 CEST 2006

On Fri, 27 Oct 2006, Ravi Kondamuru wrote:

> How does one figure all the builtin libraries/ classes that python 
> supports?
> For example if I want to sort a list of names, I would normally think of 
> implementing the sorting routine in C. I am just beginning to learn 
> python. It looks like there is a rich set available builtin libraries. 
> So, is there one place where I can look to figure out I dont have to 
> write afresh.

Hi Ravi,

As with any reference material, it's a good idea to try the "index" of the 
relevant documentation.  You might not always find what you're looking 
for, but it can be effective.

In this particular case, you've guessed that there might be something in 
the Library that might help you.  If you search for "sort" in the Library 


You should see an index entry labeled "sort() (list method)".  Looking up 
that index entry should bring you to a page describing the methods on 


So looking at the reference is useful if you already know what you're 
looking for.  In this case, yes, there is a built-in sort.  Even better, 
there's a dedicated guide to using Python's sort functionality:


If you want to get an overview of the extent of Python's library, try the 
table of contents:


There's a heck of a lot of stuff there, so asking someone to memorize it 
is ridiculous.  Still, it can help to scan through it sometimes to get a 
better idea of what services the Library provides.  I've often been amazed 
at the gems in there.  ("bisect?  Wow, I don't have to code my own binary 
search anymore!)

Another good way to learn the library is to look at what libraries other 
people use: you can read other people's code.  For example, the Python 
Cookbook provides a good source of programs that you can browse:


Finally, well, ask other people.  You've done so on Tutor, so that's a 
good start.  Many of us are happy to act as librarians to point you in 
some direction, and we usually aim not to mislead.  *grin*

More information about the Tutor mailing list