Comparing lists
Francesco Bochicchio
bieffe62 at gmail.com
Mon Aug 16 06:46:07 EDT 2010
Hi all,
anybody can point me to a description of how the default comparison of
list objects (or other iterables) works?
Apparently l1 < l2 is equivalent to all ( x < y for x,y in
zip( l1, l2) ), has is shown in the following tests, but I can't find
it described anywhere:
>>> [1,2,3] < [1,3,2]
True
>>> [1,2,3] < [1,2,4]
True
>>> [1,2,3] < [2,2,3]
True
>>> [1,2,3] < [0,1,3]
False
>>> [1,2,3] < [0,2,3]
False
>>> [1,2,3] < [1,1,3]
False
>>> [1,2,3] < [1,2,2]
False
Ciao
---
FB
More information about the Python-list
mailing list