[Pywikipedia-l] SVN: [6603] trunk/pywikipedia/wikipedia.py
cosoleto at svn.wikimedia.org
cosoleto at svn.wikimedia.org
Tue Apr 14 06:00:54 UTC 2009
Revision: 6603
Author: cosoleto
Date: 2009-04-14 06:00:54 +0000 (Tue, 14 Apr 2009)
Log Message:
-----------
Simplified Page.__cmp__() to improve performance. It becomes up to 13% faster on Barton and Python 2.5.2.
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2009-04-13 10:02:19 UTC (rev 6602)
+++ trunk/pywikipedia/wikipedia.py 2009-04-14 06:00:54 UTC (rev 6603)
@@ -1779,11 +1779,10 @@
if not isinstance(other, Page):
# especially, return -1 if other is None
return -1
- if not self.site() == other.site():
- return cmp(self.site(), other.site())
- owntitle = self.title()
- othertitle = other.title()
- return cmp(owntitle, othertitle)
+ if self._site == other._site:
+ return cmp(self._title, other._title)
+ else:
+ return cmp(self._site, other._site)
def __hash__(self):
# Pseudo method that makes it possible to store Page objects as keys
More information about the Pywikipedia-l
mailing list