Created
January 12, 2022 03:28
-
-
Save techieji/b37fedf3b11439baab947c3a0f210470 to your computer and use it in GitHub Desktop.
Oneline piping definition
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
pipe=type('',(),{'__ror__':lambda s,v:[setattr(s,'v',v),s][1],'__or__':lambda s,f:f(s.v)})() | |
# That's it. Really | |
if __name__ == '__main__': | |
# Example: | |
1 |pipe| (lambda x: x + 1) |pipe| print |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment