pytilities.overloading.overload

class pytilities.overloading.overload.Overload(operation, *params)

A list of parameters that when matched, call an associated operation.

You can think of it as part of an operation signature

Methods:

  • process_call: Call overload’s operation if args match.
  • insert_params: Insert parameters
__init__(operation, *params)

Construct an Overload

Parameters:

function
the operation to call when a call’s args match the params
params :: (Parameter...)
sequence of parameters that args of calls should match. The overload will only match when all params are satisfied and no args are left.
insert_params(index, *params)

Insert parameters into the current list of parameters at index

Parameters:

index :: number
index of where to insert
params :: (Parameter...)
the parameters to insert
process_args()

Process args and kwargs

Returns:

(processed args, operation) if matched, None otherwise

Return type:

({string: object, callable}

Parameters:
  • args ((object, ...)) – positional arguments
  • kwargs ({string: object}) – keyword arguments
__weakref__

list of weak references to the object (if defined)

Previous topic

pytilities.overloading.compositeparameter

Next topic

pytilities.overloading.overloader

This Page