[MATRIX-SIG] cmp?

Aaron Watters arw@dante.mh.lucent.com
Tue, 17 Jun 1997 13:06:22 -0400


You're probably right that Numeric deserves
to have an array as the result of cmp.  The
desire to generalize cmp has occured to many,
including me.

FWIW what I'm doing now
is using numeric to hold columns of
numeric data where each column
may be of a different format.

Say I have a table with columns

product_id, dept_number, sales expenses

I want to be able to do the analogue of

select product_id, dept_number, sum(sales-expenses)
from sales_info
group by product_id, dept_number

with result columns

product_id, dept_number, sum(sales-expenses) for dept&prod

This would result in a summary report listing
the total sales less expenses for each product
id and department number.  To do this I need
some mechanism to group product_id, dept_number
matches together...

I can get by translating arrays to tuples if I must.

An alternative would be to provide an array
lexicographic comparator not in the type structure
(implemented in C and specialized to
arrays for speed).  Then I could
write

list_of_arrays.sort(lexicographic)

or whatever.  

In sum, I now understand why it works the way it
does, and I am content.  -- Aaron Watters



_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________