Created
April 9, 2013 06:20
-
-
Save chaobin/5343369 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env python | |
def remove_a(values): | |
for value in values: | |
new_value = value.replace('a', '') | |
print 'remove a' | |
yield new_value | |
def remove_b(values): | |
for value in values: | |
new_value = value.replace('b', '') | |
print 'removed b' | |
yield new_value | |
def remove_c(values): | |
for value in values: | |
new_value = value.replace('c', '') | |
print 'removed c' | |
yield new_value | |
def pipeline(_file): | |
chain = remove_c(remove_b(remove_a(open(_file)))) | |
return chain | |
def generator(): | |
answer = (yield) | |
if answer == 'stupid': | |
kill() | |
try: | |
anything() | |
except ValueError: | |
other() | |
finally: | |
cleanup() | |
g = generator() | |
g.send(fgsdfg) | |
g.throw(ValueError) | |
g.close() | |
threading.Thread() | |
multitask |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment