common package¶
Provide common classes and functions.
The common module and its submodules probides varies functions ans classes which can be used in any context.
Functions¶
This module provides the following functions which are alias of ones in sub-modules.
print_args
- Decorate a function so that print arguments before calling it.
print_return
- Decorate a function so that print result after calling it.
constant
- Decorate a function so that the result is a constant value.
memoized
- Decorate a function to memoize results.
Submodules¶
common.decorator module¶
Defines common decorators.
This module provides useful decorators.
-
common.decorator.
constant
(func)[source]¶ Decorate a function so that the result is a constant value.
Functions wraped by this decorator will be run just one time. The computational result will be stored and reused for any other input.
To store each result for each input, use
memoized()
instead.
-
common.decorator.
memoized
(func)[source]¶ Decorate a function to memoize results.
Functions wraped by this decorator won’t compute twice for each input. Any results will be stored. This decorator might increase used memory in order to shorten computational time.
common.helper module¶
Mixins for algebraic classes.