http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10178
Revision: 10178 Author: xqt Date: 2012-05-05 09:27:47 +0000 (Sat, 05 May 2012) Log Message: ----------- code optimations: use xrange iterator intead of range list; s[:-x] instead of s[:len(s)-x]. Follow up for r10160
Modified Paths: -------------- trunk/pywikipedia/version.py
Modified: trunk/pywikipedia/version.py =================================================================== --- trunk/pywikipedia/version.py 2012-05-05 07:02:53 UTC (rev 10177) +++ trunk/pywikipedia/version.py 2012-05-05 09:27:47 UTC (rev 10178) @@ -64,16 +64,16 @@ cur.execute( '''select local_relpath, repos_path, revision, changed_date from nodes order by revision desc, changed_date desc''') name, tag, rev, date = cur.fetchone() con.close() - tag = tag[:len(tag) - len(name)] + tag = tag[:-len(name)] date = time.gmtime(date/1000000) else: - for i in range(3): + for i in xrange(3): entries.readline() tag = entries.readline().strip() t = tag.split('://') t[1] = t[1].replace('svn.wikimedia.org/svnroot/pywikipedia/', '') tag = '[%s] %s' % (t[0], t[1]) - for i in range(4): + for i in xrange(4): entries.readline() date = time.strptime(entries.readline()[:19],'%Y-%m-%dT%H:%M:%S') rev = entries.readline()[:-1]
pywikipedia-svn@lists.wikimedia.org