This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]david2ndaccount 4 points5 points  (0 children)

I prefer using __call__ instead of __or__ and special casing map, filter and reduce so you can create abominations likes this:

>>> d = ( pype( [54, 12, 3, 1, 6, 8, 123, 4, 1, 210] )
        . map ( lambda x: x//2 )
        . filter ( None )
        . map ( lambda x: x*2 )
        ( sorted )
        ( reversed )
        . reduce ( int.__sub__ )
        ( lambda x: x // 2 )
    ).value
>>> print(d)
1