Introduction
Python Project vectorize
Introduction
To import the project simply type
>>> from vectorizeit import vectorize
after installation and use vectorize as a decorator to iterate over arguments of list type.
>>> @vectorize()
... def foo(a, b):
... return a, b
>>> foo((1, 2), ['a', 'b'])
(((1, 'a'), (1, 'b')), ((2, 'a'), (2, 'b')))
This works also with specifying arguments to be vectorized.
>>> @vectorize(keys=['b'])
... def foo(a, b):
... return a, b
>>> foo((1, 2), ['a', 'b'])
((1, 2), 'a'), ((1, 2), 'b'))
Setting the zipped decorator argument will iter in parallel over the multiple vector inputs as have been zipped.
>>> @vectorize(keys=['b', 'c'], zipped=True)
... def foo(a, b):
... return a, b
>>> foo((1, 2), ['a', 'b'])
((1, 'a'), (2, 'b'))
For more see the detailed documentation.
Install
The latest stable version can always be installed or updated via pip:
$ pip install vectorizeit
License
Code and documentation are available according to the license (see LICENSE file in repository).