Class Map
Instruction
--+
|
Stage
--+
|
Map
- Known Subclasses:
-
Zip
flow equivalent to map: Map(function, stage, ... )
Apply a function to every item yielded and yield the results.
If additional stages are passed, the function must take that
many arguments and is applied to the items of all lists in
parallel. If a list is shorter than another, it is assumed
to be extended with None items. If the function is None,
the identity function is assumed; if there are multiple list
arguments, Map stage returns a sequence consisting of tuples
containing the corresponding items from all lists.
def fn(val):
return val + 10
source = flow.Map(fn,range(4))
printFlow(source)
Method Summary |
|
__init__(self,
func,
stage,
*stages)
|
|
__iter__(self)
(inherited from Stage )
|
|
next (self)
return current result (inherited from Stage )
|