Created
September 8, 2014 21:56
-
-
Save Stiivi/f978ef316941c6f772ae to your computer and use it in GitHub Desktop.
Bubbles 0.3 (prototype 3) feature preview
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 bubbles import Pipeline, ExecutionEngine | |
from bubbles import operation, datasource | |
# New implicit iterator operations | |
@datasource(fields=["i"]) | |
def generator(context, count=10): | |
for i in range(count): | |
yield [i] | |
@operation | |
def add(context, src, amount=1): | |
for row in src: | |
yield [row[0]+amount] + row[1:] | |
@operation | |
def pretty_print(context, src): | |
for row in src: | |
print(row) | |
# New generative interface | |
p = Pipeline() | |
p.generator().add(amount=10).pretty_print() | |
# Execution responsibility moved to extensible/replacable execution engine | |
e = ExecutionEngine() | |
e.run(p.graph) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment