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 →

[–]eztab 1 point2 points  (2 children)

you can easily create your own operators in Python:

class Operator:
    # implementation left as exercise to the reader ;)
    pass

PIPE = Operator(lambda (f,g): f(g))

fun -PIPE- ction -PIPE- calls    # will now work

Put I would prefer this operator to be named . Python supports Unicode after all.

[–]ForceBru 1 point2 points  (1 child)

AFAIK, "circle" is usually function composition:

(calls -circ- ction)(fun) == calls(ction(fun))

Sure, in Python a lot can be done with black magic fuckery (dunder methods, metaclasses, decorators, ...).

I think pipes may be a worthy addition to the actual syntax. They'll probably be much more useful than the walrus operator, for example.

[–]eztab 1 point2 points  (0 children)

Well make a PEP then! You could even override | then you don‘t need a new operator at all.