[PYTHON MATRIX-SIG] Comparisons

Rob Hooft Rob.Hooft@EMBL-Heidelberg.de
Wed, 3 Apr 1996 15:04:53 +0200


>>>>> "KH" == Konrad HINSEN <hinsenk@ERE.UMontreal.CA> writes:

 >>  Repeatedly there has been a discussion about "<" and ">"
 >> comparisons for Array objects. Why can that not be implemented in
 >> the "dictionary" way? It just needs to be made recursive. Like:
 >> 
 >> a<b if: (a[0]<b[0]) or (a[0]==b[0] and (a[1]<b[1] or len(a)=1)) or
 >> ....

 KH> It probably can be implemented in such a way, but why?  For what
 KH> application would this definition be useful?

It would allow sorting an Array of transformation matrices, which then
allows some sort of binary search to see whether a certain
transformation is in there. Of course, a hash value could be used as
well in this case (is that implemented? Arrays are not hasheable, as
they are mutable, isn't it?), but there might be other uses for
comparisons.

As I said I haven't even compiled the software yet, so risking that
I'm quoting outdated information: I think Guido has said that there is
no provision for comparisons to generate exceptions yet. The
implementation I proposed might be a reasonable one to convert (a<b)
into a boolean.....

Rob.

-- 
=== Rob.Hooft@EMBL-Heidelberg.DE   http://www.Sander.EMBL-Heidelberg.DE/rob/ ==
==== In need of protein modeling?  http://www.Sander.EMBL-Heidelberg.DE/whatif/
Validation of protein structures?  http://biotech.EMBL-Heidelberg.DE:8400/ ====
================ Long Live Linux!  Free Software Rules The World! =============

=================
MATRIX-SIG  - SIG on Matrix Math for Python

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