consistency: extending arrays vs. multiplication ?

Soeren Sonnenburg python-ml at nn7.de
Sun Jul 24 10:24:28 EDT 2005


On Sun, 2005-07-24 at 13:36 +1000, Steven D'Aprano wrote:
> On Sat, 23 Jul 2005 18:30:02 +0200, Soeren Sonnenburg wrote:
> 
> > Hi all,
> > 
> > Just having started with python, I feel that simple array operations '*'
> > and '+' don't do multiplication/addition but instead extend/join an
> > array:
> 
> * and + are not array operations, they are list operations.
> 
> Lists in Python can contain anything, not just numeric values.

That seems to be *the point*. Although list(a) + list(b) could create a
list [ a[0]+b[0], ...] and bail out if for elements '+' is not
defined...

> Python doesn't have built-in mathematical arrays, otherwise known as
> matrices. There are modules that do that, but I haven't used them. Google
> on Numeric Python.

Well I am aware of that but I don't understand the reasons of having
both lists (which are infect arrays) and *arrays ? *I* would rather drop
'+' and '*' to work like they do in *array ...

Soeren




More information about the Python-list mailing list