[Numpy-discussion] [help needed] associativity and precedence of '@'

Robert Kern robert.kern at gmail.com
Thu Mar 20 09:41:07 EDT 2014


On Thu, Mar 20, 2014 at 1:36 PM, Dag Sverre Seljebotn
<d.s.seljebotn at astro.uio.no> wrote:
> On 03/20/2014 02:26 PM, Dag Sverre Seljebotn wrote:

>> I'm positive to the chained @ idea, I think it's the answer to "what we
>> really want".
>
> Sorry, I totally misunderstood this. The question is of course how you
> dispatch technically (where the __matmul__ function lives and which one
> to use), not figuring out what you want done.
>
> I think you'd need to keep this very simple; for instance, just require
> the leftmost matrix to implement __matmul__ that takes a list, ditch
> __rmatmul__, and then solve the rest on the library level.
>
> In our case, everyone would delegate __matmul__ to something in NumPy
> that then supports hooks and solves this on the library level. That
> would work as I say above + hooks to plug in cost estimators and compute
> functions for various matrix products.

To me, that signals that it's time to drop the operator for a library
of functions, just like I prefer solve() and company to a matrix
division operator.

-- 
Robert Kern



More information about the NumPy-Discussion mailing list