The declarative module is accessible via the formencode module.
Declarative objects have a simple protocol: you can use classes in lieu of instances and they are equivalent, and any keyword arguments you give to the constructor will override those instance variables. (So if a class is received, we'll simply instantiate an instance with no arguments).
You can provide a variable __unpackargs__ (a list of strings), and if the constructor is called with non-keyword arguments they will be interpreted as the given keyword arguments.
If __unpackargs__ is ('*', name), then all the arguments will be put in a variable by that name.
Also, you can define a __classinit__(cls, new_attrs) method, which will be called when the class is created (including subclasses).
Acts like a class method when called from a class, like an instance method when called by an instance. The method should take two arguments, 'self' and 'cls'; one of these will be None depending on how the method was called.
This class contains 2 members.
This class contains 13 members.
For Declarative subclasses, this decorator will call the method on the cls.singleton() object if called as a class method (or as normal if called as an instance method).
This class contains 2 members.
This class contains 11 members.
See the source for more information.