The codecs module provides stream and file interfaces for
transcoding data in your program. It is most commonly used to work
with Unicode text, but other encodings are also available for other
purposes.
Doug Hellmann
Code Interstices All the little things that happen between bouts of coding. Covering internet technologies, Python, Mac OS X, and open source.
Sunday, August 29, 2010
PyMOTW: codecs - String encoding and decoding
Sunday, August 22, 2010
PyMOTW: math - Mathematical functions
The math module implements many of the IEEE functions that would
normally be found in the native platform C libraries for complex
mathematical operations using floating point values, including
logarithms and trigonometric operations.
Sunday, August 15, 2010
PyMOTW: doctest - Testing through documentation
doctest lets you test your code by running examples embedded in
the documentation and verifying that they produce the expected
results. It works by parsing the help text to find examples, running
them, then comparing the output text against the expected value. Many
developers find doctest easier than unittest because in
its simplest form, there is no API to learn before using it. However,
as the examples become more complex the lack of fixture management can
make writing doctest tests more cumbersome than using
unittest.
Sunday, August 8, 2010
PyMOTW: argparse - Command line option and argument parsing.
The argparse module was added to Python 2.7 as a replacement
for optparse. The implementation of argparse supports
features that would not have been easy to add to optparse, and
that would have required backwards-incompatible API changes, so a new
module was brought into the library instead. optparse is still
supported, but is not likely to receive new features.
Sunday, July 11, 2010
PyMOTW: gc - Garbage Collector
Read more
[Updated because I couldn't get Blogger to format the code and output lines properly. Please visit my main site for the full text.]