[Numpy-discussion] Proposed deprecations for 1.10: dot corner cases

Nathaniel Smith njs at pobox.com
Mon May 11 15:52:55 EDT 2015


On May 11, 2015 12:44 PM, "Alan G Isaac" <alan.isaac at gmail.com> wrote:
>
> On 5/9/2015 4:26 PM, Nathaniel Smith wrote:
> > dot(A, B) where one of the argument is a scalar: currently, this
> > does scalar multiplication. There is no logically consistent
> > motivation for this, it violates TOOWTDI, and again it is inconsistent
> > with the PEP semantics for @ (which are that this case should be an
> > error).
>
> Do I recall incorrectly: I thought that reconciliation of `@` and `dot`
> was explicitly not part of the project on getting a `@` operator?
>
> I do not mean this to speak for or against the change above, which I only
> moderately oppose, but rather to the argument offered.

Not sure what you mean. It's true that PEP 465 doesn't say anything about
np.dot, because it's out of scope. The argument here, though, is not "PEP
465 says we have to do this". It's that it's confusing to have two
different subtly different sets of semantics, and the PEP semantics are
better (that's why we chose them), so we should at a minimum warn people
who are getting the old behavior

> As for the "logic" of the current behavior, can it not be given a
> tensor product motivation?  (Otoh, it conflicts with the current
> behavior of `vdot`.)

Maybe? I don't know of any motivation that doesn't require treating it as a
special case added only to duplicate existing behavior, but that doesn't
mean one doesnt exist...

-n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150511/3f9ee55a/attachment.html>


More information about the NumPy-Discussion mailing list