Package pytilities :: Package overloading :: Module overload :: Class Overload
[hide private]
[frames] | no frames]

Class Overload

source code

object --+
         |
        Overload

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

You can think of it as part of an operation signature

Methods:

Instance Methods [hide private]
 
__init__(self, operation, *params)
Construct an Overload
source code
 
process_call(self, args, kwargs)
Call the overload's operation with args if all args match.
source code
 
insert_params(self, index, *params)
Insert parameters into the current list of parameters at index
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, operation, *params)
(Constructor)

source code 

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.
Overrides: object.__init__

process_call(self, args, kwargs)

source code 

Call the overload's operation with args if all args match.

Parameters:

args :: (value...)
positional arguments of the call
kwargs :: {name::string : value}
keyword arguments of the call

Returns (True, return_value) if the args matched, (False, None) otherwise

insert_params(self, index, *params)

source code 

Insert parameters into the current list of parameters at index

Parameters:

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