pytilities.overloading.parameter

pytilities.overloading.parameter.Param

alias of Parameter

class pytilities.overloading.parameter.Parameter(name, *args, **kwargs)

A parameter of an operation.

It can match arguments and provide default values for them.

Note that an argument matches a parameter, if its matcher returns True on the argument value or the parameter has a default.

read_arg(arg)

Read/process the given arg.

Parameters:arg – the argument value to read
Returns:True if parameter matches arg
Return type:bool
read_kwargs(kwargs)

Look in a dict for a matching arg and process its value.

Parameters:kwargs – frozen dictionary of arguments
Returns:True if a matching argument was found in kwargs
Return type:bool
write(kwargs)

Adds the last read argument value to a dictionary.

Parameters:

kwargs – the dictionary to add the last value and the parameter name to

Preconditions :
  1. the parameter matched on the last read
name

Previous topic

pytilities.overloading.overloader

Next topic

pytilities.overloading.decorators

This Page