[Tutor] comparing lists, __lt__ and __gt__

Kent Johnson kent37 at tds.net
Wed Jul 25 16:34:11 CEST 2007


Andrew Purdea wrote:
> Hello!
>   I can see that lists have implemented these methods in jython..
>   But i can not find any documentation on this. It looks like python 
> compares each element, and and when it finds a difference, it returns.
>   Where can  i find documenation on this? Will this behaviour remain in 
> python for future releases?

Good question! The only doc I can find on this behavior is this:
http://docs.python.org/lib/comparisons.html

which just says that the comparison operation exists. There doesn't seem 
to be any documentation on how comparison works with sequences.

I think it is pretty safe to count on the current behaviour of < and > 
for lists. I'll put in a documentation bug on this - the meaning of 
these operations (and ==) should be explicit in the docs.

Kent


More information about the Tutor mailing list