declarative

Declarative objects for FormEncode.

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).


Attributes

a counter

count(88)

a generators

_Feature((2, 2, 0, 'alpha', 1), (2, 3, 0, 'final', 0), 4096)

Classes

C classinstancemethod(...) ...

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.

C DeclarativeMeta(...) ...

This class contains 13 members.

C singletonmethod(...) ...

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.

C Declarative(...) ...

This class contains 11 members.

See the source for more information.