A Parameter is a special type of Python attribute extended to have features such as type and range checking, dynamically generated values, documentation strings, default values, etc., each of which is inherited from parent classes if not specified in a subclass.
>>> import param,random >>> class A(param.Parameterized): ... a = param.Number(0.5,bounds=(0,1),doc="Probability that...") ... b = param.Boolean(False,doc="Enable feature...") ... >>> class B(A): ... b = param.Boolean(True) ... >>> x = B(a=lambda: random.uniform(0,1)) >>> x.a 0.37053399325641945 >>> x.a 0.64907392300071842
>>> x.a=5 [...] ValueError: Parameter 'a' must be at most 1 >>> x.a="0.5" [...] ValueError: Parameter 'a' only takes numeric values
>>> help(x) [...] class B(A) [...] | Data descriptors defined here: | b | Enable feature... [...] | Data descriptors inherited from A: | a | Probability that...
Param consists of two BSD-licensed Python files, with no dependencies outside of the standard library.
Parameters make it simple to generate GUIs. An interface for Tk already exists (http://ioam.github.com/paramtk/), providing a property sheet that can automatically generate a GUI window for viewing and editing an object's Parameters.
Comprehensive reference generated from the source code:
Questions and comments are welcome at https://github.com/ioam/param/issues.