Skip to content

Instantly share code, notes, and snippets.

@ocrampete16
Created March 5, 2019 00:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ocrampete16/00e6c0d385bcec6d62e0fb60caff0d9f to your computer and use it in GitHub Desktop.
Save ocrampete16/00e6c0d385bcec6d62e0fb60caff0d9f to your computer and use it in GitHub Desktop.
A Python implementation of the Pipeline pattern
class Pipeline:
def __init__(self, value):
self.value = value
self.pipes = []
def through(self, pipe):
self.pipes.append(pipe)
def now(self):
for pipe in self.pipes:
self.value = pipe(self.value)
return self.value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment