how do you learn python APIs?

Alexander Schmolck a.schmolck at
Sat Jun 21 22:46:26 CEST 2003

Keith Beattie <KSBeattie at> writes:

> Hello,
> I'm relatively new to python and would like to know how more seasoned python
> programmers learn new APIs. 

If its part of the standard python distribution, by reading the library
reference ( Otherwise, mainly
by using interactive sessions to read docstrings and navigate the source if

> My inclination (as a recent Java programmer) is
> to have a javadoc like interface, and pydoc is close, but the lack of types
> make it difficult so discern what a method does without other documentation.

I generally have no such difficulty. Maybe the module you looked at was just
poorly documented? If documentation is poor, looking at the source is the
thing to do, frequent reading of well-written code will also quickly improve
your python skills. Another useful skill is good emacs knowledge which can
greatly speed up navigating other people's and your own code code (e.g. learn
to use `igrep-find` and above all `isearch` effectively).

> Doing dir(foo) on objects directly in the interpreter which is helpful but,
> I guess I'd like to know what the pythonic way of doing things is, or ask
> how people go about learning a new module.

My personal recommendation is to use ipython from within emacs. Ipython
(, amongst many other benefits makes it very
convinient to get info, documentation and source code for a module, function,
class or object. Try `foo?` and `foo??` to get info on object foo at different
levels of detail and `edit foo` to edit source code of object `foo` in your
editor. Last but not least, trying things out in the interactive prompt can
be a great way of figuring out what something does and how.

> Thanks,
> ksb


More information about the Python-list mailing list