On Sun, 26 Dec 2021 at 14:19, Steven D'Aprano <st...@pearwood.info> wrote: > > Using a hypothetical pipeline syntax with an even more hypothetical > arrow-lambda syntax: > > [1, 2, 3] | map(x=>x+1) | filter(a=>a%2) | list >
What is the pipeline syntax like indeed? It looks as if your ``|`` is an operator which produces callable objects, e.g., [1, 2, 3] | map such that calling it like [1, 2, 3] | map(x=>x+1) will be equivalent to map(x=>x+1, [1, 2, 3]) except that <an object> | list is apparently supposed to be a list without being called. But you might have actually meant to call it like [1, 2, 3] | map(x=>x+1) | filter(a=>a%2) | list() to get the list. The character ``|`` is OK with [1, 2, 3] , but it's already given a meaning as an operator e.g., with {1, 2, 3} . Can the syntax separate the different uses? I suppose it may be a new operator that you want. I thought some people had already essentially proposed an operator version of functools.partial although [1, 2, 3] | map will not exactly be equivalent to partial(map, [1, 2, 3]) because it's not map([1, 2, 3], x=>x+1) that you want. You want the arguments to be in a different order, but that's the only difference. Best regards, Takuo Matsuoka _______________________________________________ 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/DKEM6EXJEP2ZGAPHZNN2FUNR22VFYEJZ/ Code of Conduct: http://python.org/psf/codeofconduct/