enums ( *values )
A sequence of enumeration literals
This function is a shortcut for creating a series of model.enum()
instances. Examples:
class RGB(model.Enumeration):
red, green, blue = model.enums("R","G","B")
class Binary(model.Enumeration):
zero, one = model.enums(range(2))
class FooBar(model.Enumeration):
foo, bar = model.enums(2)
model.enums() accepts a series of arguments, and creates a model.enum()
for each one, returning the list (RGB example). If only one argument is
supplied, and it's iterable, it is used as the input list. Finally, if
only one argument is supplied, and it's not iterable, it is treated as a
count of empty model.enum() objects to be returned. In the FooBar
example, this is equivalent to saying
foo, bar = model.enum(), model.enum() .
|