Skip to content

Instantly share code, notes, and snippets.

@chaobin
Created April 9, 2013 06:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chaobin/5343369 to your computer and use it in GitHub Desktop.
Save chaobin/5343369 to your computer and use it in GitHub Desktop.
#!/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