You need fancier tricks to be able to make the Pipe object transparent, but its possible.
The approach provided in this article is bad, it tries to reinvent a bunch of things (the operator module, for itemgetter, and stuff like getattr by wrapping them in strings.
Comments
I've mentioned this before, but both of these are overengineered. You need only define a custom class that overrides the | operator.
Then you get (from the original article)
where you have something likeclass Pype: def __init__(self, f): self.f = f
You need fancier tricks to be able to make the Pipe object transparent, but its possible.The approach provided in this article is bad, it tries to reinvent a bunch of things (the operator module, for itemgetter, and stuff like getattr by wrapping them in strings.