sequence multiplied by -1
pavlovevidence at gmail.com
Tue Oct 5 01:50:39 CEST 2010
On Oct 4, 3:09 pm, Gregory Ewing <greg.ew... at canterbury.ac.nz> wrote:
> Carl Banks wrote:
> > Numpy uses + for elementwise addition, and a function
> > called concatenate for concatenation. If Python lists used a separate
> > concatenation operator, then Numpy arrays could use that for
> > concatenation.
> Actually it couldn't, except for the special case of
> concatenating along the first axis.
IOW, it could.
> The concatenate()
> function allows specifying an axis.
Take the example of the pow() function which allows several arguments,
but that doesn't prevent there from being a ** operator.
> There's also the problem that applying a concatenation
> operator to a numpy array of Python sequences would be
> ambiguous -- does it mean concatenating the arrays, or
> elementwise concatenation of their contents?
It means concatenating the arrays. The operator wouldn't be
elementwise for any other array; there is no argument to make it that
way for arrays of sequences. Non problem.
More information about the Python-list