CADETProcess.dataStructure.parameter.Callable#
- class CADETProcess.dataStructure.parameter.Callable(*args: Any, default: Any | None = None, is_optional: bool = False, unit: str | None = None, description: str | None = None, **kwargs: Any)[source]#
Parameter descriptor constrained to callable objects.
Designed to ensure a given parameter is callable. This is distinct from using a type constraint since built-in functions (e.g., those implemented in C) won’t be captured by types.FunctionTypes.
- Attributes:
defaultAny: Get or set the default value of the parameter.
Methods
get_default_value(instance)Return default values if necessary.
See also
ParameterTyped
Examples
Here’s how you might use the Callable class:
>>> class MyModel: ... func = Callable() >>> model = MyModel() >>> model.func = print # This is fine as print is callable >>> model.func = "not_callable" # This will raise a TypeError