Contents
Idiomatic Python
Some basic data kinds
List comprehensions
Constructing your personal sorts
Iterators
Generators
assert
Conclusions Structuring, Testing, and Sustaining Python Applications
Programming for reusability
Modules and scripts
Deals
A brief digression: naming and formatting
Yet another short digression: docstrings
Sharing info in between code
Scoping: a digression
Again to sharing info
How modules are loaded (and when code is executed)
PYTHONPATH,
Office 2007 Product Key, and discovering deals & modules during development
setup.py and distutils: the old fashioned way of installing Python packages
setup.py,
Microsoft Office 2007 Ultimate, eggs, and easy_install: the new fangled way of installing Python deals Testing Your Software
An introduction to testing concepts
The doctest module
Unit tests with unittest
Testing with nose
Code coverage analysis
Adding tests to an existing project
Concluding thoughts on automated testing An Extended Introduction to the nose Unit Testing Framework
What are unit tests?
Why use a framework? (and why nose?)
A few simple examples
Test fixtures
Examples are included,
Office 2007 Professional! A somewhat more complete guide to test discovery and execution
Running tests
Debugging test discovery The nose command line
-w: Specifying the working directory
-s: Not capturing stdout
-v: Info and debugging output
Specifying a listing of tests to run Running doctests in nose
The 'attrib' plug-in -- selectively running subsets of tests
Running nose programmatically
Writing plug-ins -- a simple guide
nose caveats -- let the buyer beware,
Office 2010 Pro Plus, occasionally
Credits Idiomatic Python revisited
sets
any and all
Exceptions and exception hierarchies
Function Decorators
try/finally
Function arguments,
Windows 7 Home Premium Key, and wrapping functions Measuring and Increasing Performance
Which profiler should you use?
Measuring code snippets with timeit Speeding Up Python
psyco
Installing psyco
Using psyco pyrex Tools to Help You Work
IPython
screen and VNC
Trac Online Resources for Python
Wrapping C/C++ for Python
Manual wrapping
Wrapping Python code with SWIG
Wrapping C code with pyrex
ctypes
SIP
Boost.Python
Recommendations
One or two more notes on wrapping Packages for Multiprocessing
threading
Writing (and indicating) threadsafe C extensions
parallelpython
Rpyc
pyMPI
multitask Useful Packages
subprocess
rpy
matplotlib Idiomatic Python Take 3: new-style classes
Managed attributes
Descriptors GUI Gossip
Python 3.0