@@ -12,11 +12,17 @@ def __init__(self, initlist=None):
1212 else :
1313 self .data = list (initlist )
1414 def __repr__ (self ): return repr (self .data )
15+ def __lt__ (self , other ): return self .data < self .__cast (other )
16+ def __le__ (self , other ): return self .data <= self .__cast (other )
17+ def __eq__ (self , other ): return self .data == self .__cast (other )
18+ def __ne__ (self , other ): return self .data != self .__cast (other )
19+ def __gt__ (self , other ): return self .data > self .__cast (other )
20+ def __ge__ (self , other ): return self .data >= self .__cast (other )
21+ def __cast (self , other ):
22+ if isinstance (other , UserList ): return other .data
23+ else : return other
1524 def __cmp__ (self , other ):
16- if isinstance (other , UserList ):
17- return cmp (self .data , other .data )
18- else :
19- return cmp (self .data , other )
25+ raise RuntimeError , "UserList.__cmp__() is obsolete"
2026 def __contains__ (self , item ): return item in self .data
2127 def __len__ (self ): return len (self .data )
2228 def __getitem__ (self , i ): return self .data [i ]
0 commit comments