| Home | Trees | Indices | Help |
|
|---|
|
|
object --+
|
Parameter
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.
Methods:
- `read_arg`: Read/process the given arg.
- `read_kwargs`: Look in a dict for a matching arg and process its value
- `write`: Adds the last read argument value to a dictionary.
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from |
|||
|
|||
| _matched | |||
|
Inherited from |
|||
|
|||
Construct a `Parameter`.
Parameters:
`name` :: string
name of parameter as specified in keyword arguments
`matcher` ::
Either of:
- type of the parameter
- iterable of possible types of param
- a matcher function :: f(value) -> matched::bool
`default`
default value for the parameter. Omit if param has no default
Preconditions:
1. `default` must match the specified matcher
|
Read/process the given arg.
Parameters:
`arg`
the argument value to read
Returns True if parameter matches `arg` :: bool
|
Look in a dict for a matching arg and process its value.
Parameters:
`kwargs` :: {name::string : value}
dictionary of arguments
Returns True if a matching argument was found in `kwargs` :: bool
|
Adds the last read argument value to a dictionary.
Parameters:
`kwargs` :: {name::string : value}
the dictionary to add the last value and the parameter name to
Preconditions:
1. the parameter matched on the last read
|
|
|||
_matched
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0 on Mon Jul 19 11:49:30 2010 | http://epydoc.sourceforge.net |