Python source files may contain more than one class, if the classes are closely related. If a file is getting too long, break it into several files however. Exception: files containing an Opus variable definition must contain just the one class defining the variable.
Use Python's name space mechanisms, such as modules and packages, to handle
name space issues. Use import myfile or
from myfile import MyClass. Don't use import * in code in
the repository. (It's convenient to use at the console for interactive debugging
however.)
Avoid import as, since it makes it harder to figure out what a name
refers to. If there is a name clash, use a qualified name
instead. For example, numpy and numpy.ma both have a log
function. Rather than
using from numpy import log as nlog,
use import numpy, and then within your code qualify the names, e.g.
numpy.log.
Do not use multiple-line imports, such as:
from numpy import array, repeat, transpose, ndarray, reshape, \
indices, zeros, float32, asarray, arange, compress, concatenate, bool8, put, \
logical_not, cumsum, log, where, ones, strings
These multiple line imports make it hard to search for imports of specific functions, since the ``import'' is separate from some of the function names. This in turn increases the chance of missing some instances of things you might want to change.