Soeren Sonnenburg wrote:
> 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*.

Whose point? If you mean that you want to be able to use arbitrary 
objects in an array, then look in numarray.objects for an array type 
that handles arbitrary Python objects.

> Although list(a) + list(b) could create a
> list [ a[0]+b[0], ...] and bail out if for elements '+' is not
> defined...

Unlike the current situation, where a+b always works consistently 
despite the contents, despite how long the lists are.

>>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)

They "are in [fact] arrays" only in the sense that they are containers 
of objects with a contiguous layout in memory. That doesn't imply either 
set of semantics for + and * operators.

> and *arrays ?

They're good at different things. Arrays like Numeric/numarray are 
harder to implement than the builtin lists.

> *I* would rather drop
> '+' and '*' to work like they do in *array ...

Tough. It's 14 years or so too late to make that change.

-- 
Robert Kern
[EMAIL PROTECTED]

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to