param.output#
- param.output(func, *output, **kw)[source]#
output allows annotating a method on a Parameterized class to declare that it returns an output of a specific type. The outputs of a Parameterized class can be queried using the Parameterized.param.outputs method. By default the output will inherit the method name but a custom name can be declared by expressing the Parameter type using a keyword argument.
The simplest declaration simply declares the method returns an object without any type guarantees, e.g.:
@output()
If a specific parameter type is specified this is a declaration that the method will return a value of that type, e.g.:
@output(param.Number())
To override the default name of the output the type may be declared as a keyword argument, e.g.:
@output(custom_name=param.Number())
Multiple outputs may be declared using keywords mapping from output name to the type or using tuples of the same format, i.e. these two declarations are equivalent:
@output(number=param.Number(), string=param.String())
@output((‘number’, param.Number()), (‘string’, param.String()))
output also accepts Python object types which will be upgraded to a ClassSelector, e.g.:
@output(int)