Comparison of different objects is based on typenames. when appropriate comparison is not supported for objects of the same type, address comparison is adopted. For more information, see the following sources:
Q ):
>>> filter( lambda x: x > 2, [ 1, [ 1, 2, 3 ], 2, 3 ] ) [[1, 2, 3], 3]
? :
>>> 1 < [ 1 ] True >>> int < list True >>> dict < int < list True
>>> int < map False
After several twists and turns, I discussed it with Fireboo.
1. compare different objects (except number) according to type names,
2. when objects of the same type do not support proper comparison, use address comparison.
3. list and list. tuple and tuple are compared in lexicographic order.
>>> x = 1 >>> y = [ 1 ] >>> type( x )
>>> type( y )
>>> x < y True
>>> type( int )
>>> type( list )
>>> id( int ) 505552912 >>> id( list ) 505555336 >>> int < list True
>>> type( map )
>>> type( list )
>>> map < list True