[Python-ideas] [RFC] draft PEP: Dedicated infix operators for matrix multiplication and matrix power

Robert Kern robert.kern at gmail.com
Mon Mar 17 11:35:37 CET 2014


On 2014-03-17 05:03, Nick Coghlan wrote:
> On 17 March 2014 13:46, Bruce Leban <bruce at leapyear.org> wrote:
>> I also want to give a larger example to illustrate the kind of thing I think
>> this operator would be useful for. SQLAlchemy has query objects where you
>> can write something like
>>
>> some_query.filter(...).order_by(...).join(...)
>>
>>
>> I image that this could use the @ operator:
>>
>> some_query @ filter(...) @ order_by(...) @ join(...)
>
> There are plenty of existing left-associative operators that could be
> used for that if Mike Bayer wanted (or could be convinced) to do so,
> so I don't see how that observation is relevant to the question of
> whether or not this particular proposal should be for a
> right-associative operator.

Although this does suggest that having a right-associative operator might 
provide some useful variety in the operator-overloading-as-DSL ecosystem.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco



More information about the Python-ideas mailing list