[Numpy-discussion] Consider improving numpy.outer's behavior with zero-dimensional vectors

Nathaniel Smith njs at pobox.com
Thu Apr 16 18:32:44 EDT 2015


On Thu, Apr 16, 2015 at 6:19 PM, Neil Girdhar <mistersheik at gmail.com> wrote:
> Actually, looking at the docs, numpy.outer is *only* defined for 1-d
> vectors.  Should anyone who used it with multi-dimensional arrays have an
> expectation that it will keep working in the same way?

Yes. Generally what we do is more important than what we say we do.
Changing behaviour can break code. Changing docs can change whose
"fault" this is, but broken code is still broken code. And if you put
on your user hat, what do you do when numpy acts weird -- shake your
fist at the heavens and give up, or sigh and update your code to
match? It's pretty common for even undocumented behaviour to still be
depended on.

Also FWIW, np.outer's docstring says "Input is flattened if not
already 1-dimensional", so we actually did document this.

-n

-- 
Nathaniel J. Smith -- http://vorpus.org



More information about the NumPy-Discussion mailing list