Closed bmcfee closed 7 years ago
From the itertools recipes page:
def roundrobin(*iterables):
"roundrobin('ABC', 'D', 'EF') --> A D E B F C"
# Recipe credited to George Sakkis
pending = len(iterables)
nexts = cycle(iter(it).next for it in iterables)
while pending:
try:
for next in nexts:
yield next()
except StopIteration:
pending -= 1
nexts = cycle(islice(nexts, pending))
The pipeline object allows for cascading of multiple deformers into a single chain.
Sometimes, we just want to apply a set of deformations independently, but there's no direct way to do that currently.
It would be easy to implement something analogous to a sklearn feature union that does round-robin sampling from each deformer.