Last active
February 16, 2016 21:56
-
-
Save movermeyer/a2638b28aab1131c1e89 to your computer and use it in GitHub Desktop.
stream processing error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from stream import map, ForkedFeeder, ProcessPool, PCollector | |
#Collector works with ForkedFeeder | |
collector = PCollector() | |
for i in range(10): | |
ForkedFeeder(lambda: (i for i in xrange(10))) >> collector | |
print len([x for x in collector]) | |
#Collector does not work with ProcessPool | |
collector = PCollector() | |
for i in range(10): | |
ForkedFeeder(lambda: (i for i in xrange(10))) >> ProcessPool(map(lambda x: x*x)) >> collector | |
print len([x for x in collector]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment