As a scientific Python application grows, it can be increasingly difficult to use and maintain, because of implicit assumptions made when writing each component. Users can pass any possible data type for any argument, so code either fills up with assertions and tests to see what type of data has been supplied, or else has undefined behavior for some datatypes or values. Once software is exchanged with other users, obscure error messages or even incorrect results are the likely outcome. Programming languages that require types to be declared alleviate some of these issues, but are inflexible and difficult to use, both in general and when specifying details of types (such as ranges of allowed values). Luckily, Python metaobjects make it possible to extend the Python language to offer flexible declarative typing, offering the best of both worlds.
The Param module provides a clean, low-dependency, pure-Python implementation of declarative parameters for Python objects and functions, allowing library and program developers to specify precisely what types of arguments or values are allowed. A Parameter is a special type of class attribute that supports type declarations (based on subtypes of a specified class, support for specified methods (duck typing), or any other criterion that can be tested), ranges, bounds, units, constant values, and enumerations. A Parameter has a docstring (visible at the command line or in generated documentation), inherits its default value, documentation, etc. along the class hierarchy, and can be set to dynamic values that generate a stream of numbers for use in controlling scientific code. In essence, a Parameter is a Python attribute extended to support clean, simple, robust, maintainable, and declarative scientific programming.
Param has been under continuous development and use since 2002 as part of the Topographica simulator (topographica.org), but is now being released as a separate package due to demand from users who want similar functionality in their own code. Param is very similar in spirit to the Enthought Traits library, despite having been developed independently, and offers much of the same functionality. Param is particularly useful for people who find that Traits is difficult to integrate into their work flow, since it consists of only two pure Python files with no dependencies outside the standard library. Param is also useful for people building Tk applications, and provides an optional Tk property-sheet interface that can automatically generate a GUI window for viewing and editing an object's Parameters.
Param is freely available under a BSD license from: http://ioam.github.com/param/