pytilities.overloading.compositeparameter

pytilities.overloading.compositeparameter.CompositeParam

alias of CompositeParameter

class pytilities.overloading.compositeparameter.CompositeParameter(name, params, matcher=(<class 'tuple'>, <class 'list'>, <class 'dict'>), *args, **kwargs)

Parameter that consists of more parameters.

This parameter matches lists, tuples and dicts, of which all elements match the list of child parameters.

When this parameter is written to a dict, its child parameters are expanded. E.g. for a composite parameter with childs ‘x’ and ‘y’, a read value of (1, 3) and a dict d of {}; after writing to d, d will equal {x:1, y:3}, and not {{x:1, y:3}}.

_CompositeParameter__match(value)
__init__(name, params, matcher=(<class 'tuple'>, <class 'list'>, <class 'dict'>), *args, **kwargs)

Construct a CompositeParameter.

Parameters:
  • name (string) – name of the parameter, used for keyword arguments. Must be unique.
  • params ((Parameter...)) – the child parameters of the composite
  • matcher

    Either of:

    • f(value) -> matched:bool
    • (type...) = (tuple, list, dict)
    • type

    the parameter will match only if this matcher matches the arg and its child args match the elements of the arg. It is unlikely you’ll need a value other than the default.

  • default – default value for the parameter, omit if param has no default
write(kwargs)

Previous topic

pytilities.overloading

Next topic

pytilities.overloading.overload

This Page