Changed subject line. This is far from original topic. On Sun, May 24, 2020, 9:35 AM Ram Rachum <r...@rachum.com> wrote:
> What's wrong with using @? If I understand correctly, it's used for matrix > multiplication, which is far enough from function composition to avoid > confusion. And it's slightly similar visually to a circle. > I like @. Function composition is kinda-sorta enough like for product that I can even make sense of the same operator. But how would you go about getting a .__matmul__ attribute onto all functions. For ones you write yourselves, you could decorate them at definition. What about all the other functions though. I suppose this is possible: @compasable def foo(x): return x + "foo" len = composable(len) newfun = len @ foo @ str.upper nbar = newfun("bar") # 6 I deliberately didn't decorate str.upper in the example since it shouldn't matter for a left-associative operator.
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/RZLALB7SIIJTJPY55RYWKA644UYTRLBR/ Code of Conduct: http://python.org/psf/codeofconduct/