About Python Module of the Week¶
PyMOTW is a series of blog posts written by Doug Hellmann. It was started as a way to build the habit of writing something on a regular basis. The focus of the series is building a set of example code for the modules in the Python standard library.
Complete documentation for the standard library can be found on the Python web site at http://docs.python.org/library/.
The output from all the example programs has been generated with CPython (see below for version) and inserted into the text using cog.
$ python -V Python 2.7.8
Some of the features described here may not be available in earlier versions of the standard library. When in doubt, refer to the documentation for the version of Python you are using.
The motw Command Line Interface¶
PyMOTW includes a command line program, motw, to make it even easier to access the examples while you are developing. Simply run motw module to open the local copy of the HTML text for the named module. There are also options to view the articles in different formats (see the -h output for details).
Usage: motw [options] <module_name>
|-h, --help||show this help message and exit|
|-t, --text||Print plain-text version of help to stdout|
|-w, --web||Open HTML version of help from web|
|--html||Open HTML version of help from installed file|
Using PyMOTW with the Interactive Interpreter¶
PyMOTW articles are at your fingertips while you’re working with the Python interactive interpreter. Importing PyMOTW adds the function motw() to the __builtins__ namespace. Run motw(module) to see the help for an imported module. Enclose the name in quotes for a module that you haven’t already imported.
$ python Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39) [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import PyMOTW >>> motw('atexit') atexit -- Call functions when a program is closing down ******************************************************* ...
Translations and Other Versions¶
Ralf Schönian is translating PyMOTW into German, following an alphabetical order. The results are available on his web site, http://schoenian-online.de/pymotw.html. Ralf is an active member of the pyCologne user group in Germany and author of pyVoc, the open source English/German vocabulary trainer (http://code.google.com/p/pyvoc/).
Roberto Pauletto is working on an Italian translation at http://robyp.x10host.com/. Roberto creates Windows applications with C# by day, and tinkers with Linux and Python at home. He has recently moved to Python from Perl for all of his system-administration scripting.
Ernesto Rico Schmidt provides a Spanish translation that follows the English version posts. Ernesto is in Bolivia, and is translating these examples as a way to contribute to the members of the Bolivian Free Software community who use Python. The full list of articles available in Spanish can be found at http://denklab.org/articles/category/pymotw/, and there is an RSS feed.
Tetsuya Morimoto is creating a Japanese translation. Tetsuya has used Python for 1.5 years. He has as experience at a Linux Distributor using Python with yum, anaconda, and rpm-tools while building RPM packages. Now, he uses it to make useful tools for himself, and is interested in application frameworks such as Django, mercurial and wxPython. Tetsuya is a member of Python Japan User’s Group and Python Code Reading. The home page for his translation is http://ja.pymotw.com/.
Gerard Flanagan is working on a “Python compendium” called The Hazel Tree. He is converting a collection of old and new of Python-related reference material into reStructuredText and then building a single searchable repository from the results. I am very pleased to have PyMOTW included with works from authors like Mark Pilgrim, Fredrik Lundh, Andrew Kuchling, and a growing list of others.
Thank you to John Benediktsson for the original HTML-to-reST conversion.
Copyright and Licensing¶
All of the prose from the Python Module of the Week is licensed under a Creative Commons Attribution, Non-commercial, Share-alike 3.0 license. You are free to share and create derivative works from it. If you post the material online, you must give attribution and link to the PyMOTW home page (http://www.doughellmann.com/PyMOTW/). You may not use this work for commercial purposes. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
The source code included here is copyright Doug Hellmann and licensed under the BSD license.
Copyright Doug Hellmann, All Rights Reserved
Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Doug Hellmann not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission.
DOUG HELLMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DOUG HELLMANN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.