Odds and Ends - Python Bootcamp
Constantine Lignos
Contents
Argument parsing using argparse
Parsing sys.argv
yourself can be quite a pain. If your program takes
more than one or two fixed arguments, it can be very handy to use
argparse, which
does all the hard work for you. Take a look at the concordance
example to see this in use.
Collections
Many simple tasks like constructing dictionaries with default values and keeping track of counts are made easier by the defaultdict and Counter classes. Take a look at the documentation on collections for an overview.
Scientific computing
Check out NumPy and SciPy. NumPy provides an array type, linear algebra functions, Fourier transform, and a number of other handy numeric features. SciPy provides routines for optimization and integration, reading MATLAB structures, and a number of other useful things.