O'Reilly logo

Python in a Nutshell by Alex Martelli

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Python Resources

The richest of all Python resources is the Internet. The starting point is Python’s site, http://www.python.org, which is full of interesting links that you will want to explore. And http://www.jython.org is a must if you have any interest in Jython.


Python and Jython come with good documentation. The manuals are available in many formats, suitable for viewing, searching, and printing. You can browse the manuals on the Web at http://www.python.org/doc/current/. You can find links to the various formats you can download at http://www.python.org/doc/current/download.html, and http://www.python.org/doc/ has links to a large variety of documents. For Jython, http://www.jython.org/docs/ has links to Jython-specific documents as well as general Python ones. The Python FAQ (Frequently Asked Questions) is at http://www.python.org/doc/FAQ.html, and the Jython-specific FAQ is at http://www.jython.org/cgi-bin/faqw.py?req=index.

Most Python documentation (including this book) assumes some software development knowledge. However, Python is quite suitable for first-time programmers, so there are exceptions to this rule. A few good introductory online texts are:

Newsgroups and Mailing Lists

The URL http://www.python.org/psa/MailingLists.html has links to Python-related mailing lists and newsgroups. Always use plain-text format, not HTML, in all messages to mailing lists and newsgroups.

The Usenet newsgroup for Python discussions is comp.lang.python. The newsgroup is also available as a mailing list. To subscribe, send a message whose body is the word subscribe to . Python-related announcements are posted to . To subscribe to its mailing-list equivalent, send a message whose body is the word subscribe to . To subscribe to Jython’s mailing list, visit http://lists.sf.net/lists/listinfo/jython-users. To ask for individual help with Python, email your question to . For questions and discussions about using Python to teach or learn programming, write to .

Special Interest Groups

Discussions on specialized subjects related to Python take place on the mailing lists of Python Special Interest Groups (SIGs). http://www.python.org/sigs/ has a list of active SIGs and pointers to general and specific information about them. Over a dozen SIGs are active at the time of this writing. Here are a few examples:


Bindings between C++ and Python


Internationalization and localization of Python programs


Image processing in Python

Python Business Forum

The Python Business Forum (PBF), at http://www.python-in-business.org/, is an international society of companies that base their business on Python. The PBF was formed quite recently, but the site already offers interesting information about business uses of Python.

Python Journal

The Python Journal, http://pythonjournal.cognizor.com/, is a free online publication focusing on Python, how to use it, and its applications.

Extension Modules and Python Sources

A good starting point to explore the world of available Python extensions and sources is “The Vaults of Parnassus,” available at http://www.vex.net/parnassus/. It contains over 1,000 classified and commented links. By following these links, you can find and download most freely available Python modules and tools.

The standard Python source distribution contains excellent Python source code in the standard library and in the Demos and Tools directories, as well as C source for the many built-in extension modules. Even if you have no interest in building Python from source, I suggest you download and unpack the Python source distribution for study purposes.

Many Python modules and tools covered in this book also have dedicated sites. References to these sites are included in the appropriate chapters in this book.

The Python Cookbook

ActiveState has built a collaborative web site at http://www.activestate.com/ASPN/Python/Cookbook that contains a living collection of Python recipes. Each recipe contains some Python code, with comments and discussion, contributed by volunteers and enriched with the contributions of readers, under the editorial supervision of David Ascher. All code is covered by a license similar to Python’s. Everyone is invited to participate as author and reader in this interesting and useful community endeavor. Hundreds of recipes from the site, edited, commented, and grouped into chapters with introductions by well-known Python experts, are published by O’Reilly as the Python Cookbook, edited by Alex Martelli and David Ascher.

Books and Magazines

Although the Net is a rich source of information, books and magazines still have their place (if you and I didn’t agree on this, I wouldn’t be writing this book, and you wouldn’t be reading it). At the time of this writing, the only magazine entirely devoted to Python is Py (for updated information, visit http://www.pyzine.com/).

Books about Python and Jython are more numerous. Here are a few that I recommend:

  • If you are just starting to learn Python (but have some previous programming experience), Learning Python, by Mark Lutz and David Ascher (O’Reilly), will serve you well. It sticks to the basics of Python’s language and core libraries, covering clearly and in depth each of the subjects it touches.

  • Python Web Programming, by Steve Holden (New Riders), teaches the basics of both Python and many other technologies that help you build dynamic web sites, including TCP/IP, HTTP, HTML, XML, and relational databases. The book offers substantial examples, including a complete database-backed site.

  • Python Programming on Win32, by Mark Hammond and Andy Robinson (O’Reilly), is indispensable for optimal Python use on Windows. The book details platform-specific extensions to Python for COM, ActiveScripting, Win32 API calls, and integration with Windows applications. The current edition uses Python’s old 1.5.2 version, but everything also applies to Python’s current version.

  • Jython Essentials, by Samuele Pedroni and Noel Rappin (O’Reilly), is a rich and concise book on Jython, suitable if you already have some Java knowledge. For effective Jython use, I also suggest Java in a Nutshell, by David Flanagan (O’Reilly).

  • Python Essential Reference, by David Beazley (New Riders), is a concise but complete reference to the Python language and its standard libraries.

  • Python Standard Library, by Fredrik Lundh (O’Reilly), offers terse and usable coverage of all modules in the standard Python library, with over 300 well-commented scripts to show how you can use each module. The amount and quality of examples stands out as the book’s outstanding feature.

  • For a massive, wide-ranging treatise on Python applications and techniques, including many large examples, you can’t beat Programming Python, by Mark Lutz (O’Reilly).

  • For a very concise summary reference and reminder of Python’s essentials, check out Python Pocket Reference, also by Mark Lutz (O’Reilly).

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required