Sunday, August 29, 2010

PyMOTW: codecs - String encoding and decoding

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.

Read more...


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.

Read more...


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.

Read more...


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.

Read more...


Sunday, July 11, 2010

PyMOTW: gc - Garbage Collector

gc exposes the underlying memory management mechanism of Python, the automatic garbage collector. The module includes functions for controlling how the collector operates and to examine the objects known to the system, either pending collection or stuck in reference cycles and unable to be freed.

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.]