[MATRIX-SIG] Patch adding compare(x,y) and <,<=,==, etc. to PyObject arrays.

Timothy A. Hochberg Timothy A. Hochberg" <hochberg@wwa.com
Thu, 21 Aug 1997 15:03:23 -0500 (CDT)

Konrad said it would be hard, so I had to do it...

1) I added a compare function compares python arrays element by element.
For example compare([1,2,4], [4,2,1]) returns array([ -1,  0, 1]). This
works with arrays of PyObjects as well as the numerical types.

2) I extended less, less_equal, etc. to work with arrays of PyObjects.

Of course the number of times I've had to compare PyObjects is, well,
zero. However, compare might be more useful. For instance sign(x) can be
implemented as compare(x,0).

And besides, this is what revealed the complex to PyObject conversion bug,
so it wasn't totally useless...

Anyway, if anyone is interested in this, the patches are available on my
starship page: http://starship.skyport.net/~hochberg


|Tim Hochberg            Research Assistant      |
|hochberg <at> wwa.com   University of Illinois  |
|                        Electrical Engineering  |

MATRIX-SIG  - SIG on Matrix Math for Python

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