[Python-ideas] Infix functions

Andrew Barnert abarnert at yahoo.com
Mon Feb 24 08:06:52 CET 2014


On Feb 23, 2014, at 17:35, Steven D'Aprano <steve at pearwood.info> wrote:

> On Sun, Feb 23, 2014 at 12:47:46PM -0800, Andrew Barnert wrote:
> 
>> Of course this is me talking about Bruce's idea. I don't want to put 
>> words in his mouth. And I also don't want people to forget that _my_ 
>> idea was using infix functions for _non-mathematical_ cases, and this 
>> is only a minor sideline to me.
> 
> I can't think of many useful examples of infix operators that aren't 
> mathematical, and even fewer that aren't just as easily written as 
> methods or functions.

Turning with and except into readable expressions without needing to add new custom syntax for each was my initial motivation. It's possible there are only a handful of such cases, and only one of them is important enough to be worth doing, in which case custom syntax for that one is the best answer. But given that half the proposals on this list are for some form of new expression syntax, I'm not sure that's the case.


More information about the Python-ideas mailing list