It's been raised a few times, but the problem is that there's no evidence that anyone actually needs a short way to perform composition - notice the composition operation's never even been added to functools. If you do want to make that case though then there's nothing stopping you :-)
I haven't been following this thread too closely, so please stop me if this has been covered, but has overloading the @ operator as function composition been considered yet?An example would befilter(a @ b, lst)as opposed tofilter(lambda x: a(b(x)), lst)On Sun, Apr 6, 2014 at 6:51 PM, Nathaniel Smith <njs@pobox.com> wrote:
On Mon, Apr 7, 2014 at 12:20 AM, Steven D'Aprano <steve@pearwood.info> wrote:Pretty much. Just posted to python-dev:
> On Sun, Apr 06, 2014 at 11:02:00PM +0100, Nathaniel Smith wrote:
>> On Sun, Mar 16, 2014 at 1:05 PM, Nick Coghlan <ncoghlan@gmail.com> wrote:
>> > Aye, but at the moment it makes sense to wait and see if there is even
>> > an argument to be had - Nathaniel may decide that even after reviewing
>> > the question seriously, he doesn't want to propose a right associative
>> > operator :)
>>
>> And indeed, that does seem to be the way things have worked out :-).
>> http://mail.scipy.org/pipermail/numpy-discussion/2014-April/069834.html
>
> That's a shame in one way -- for anyone using operator overloading to
> define their own DSL, there's only ** if you want a right-associative
> operator to overload. Still, that's an extremely marginal, and
> hypothetical, use-case. Left-associative it is.
>
> Was that the last blocker for the PEP?
https://mail.python.org/pipermail/python-dev/2014-April/133791.html
-n
--
Nathaniel J. Smith
Postdoctoral researcher - Informatics - University of Edinburgh
http://vorpus.org
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/