Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/tools
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30595/Pythonwin/pywin/tools
Modified Files:
hierlist.py
Log Message:
rationalize rich-cmp support for 'browser' related items
Index: hierlist.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/tools/hierlist.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** hierlist.py 26 Nov 2008 08:39:33 -0000 1.10
--- hierlist.py 5 Jan 2009 11:06:00 -0000 1.11
***************
*** 313,314 ****
--- 313,331 ----
def GetSelectedBitmapColumn(self):
return None # same as other
+ # for py3k/rich-comp sorting compatibility.
+ def __cmp__(self):
+ # this is always overridden, but to be sure...
+ return cmp(id(self), id(other))
+ def __lt__(self, other):
+ try:
+ return self.__cmp__(self, other) < 0
+ except TypeError:
+ # we want unrelated items to be sortable...
+ return id(self) < id(other)
+ # for py3k/rich-comp equality compatibility.
+ def __eq__(self, other):
+ try:
+ return __cmp__(self, other) == 0
+ except TypeError:
+ # unrelated items compare false
+ return 0
|