Mercurial > hg
changeset 11500:b782a7eb9037
record: removed 'reduce' calls (unsupported by py3k)
Quoting python's documentation, "Note that sum(range(n), m) is
equivalent to reduce(operator.add, range(n), m)". The "sum" function
is a builtin from 2.3 on and there's no reason for not to use it.
author | Renato Cunha <renatoc@gmail.com> |
---|---|
date | Thu, 01 Jul 2010 19:27:03 -0300 |
parents | 324cd681fa47 |
children | deb5d02ae91c |
files | hgext/record.py |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/record.py Thu Jul 01 19:27:03 2010 -0300 +++ b/hgext/record.py Thu Jul 01 19:27:03 2010 -0300 @@ -10,7 +10,7 @@ from mercurial.i18n import gettext, _ from mercurial import cmdutil, commands, extensions, hg, mdiff, patch from mercurial import util -import copy, cStringIO, errno, operator, os, re, tempfile +import copy, cStringIO, errno, os, re, tempfile lines_re = re.compile(r'@@ -(\d+),(\d+) \+(\d+),(\d+) @@\s*(.*)') @@ -355,8 +355,8 @@ applied[chunk.filename()].append(chunk) else: fixoffset += chunk.removed - chunk.added - return reduce(operator.add, [h for h in applied.itervalues() - if h[0].special() or len(h) > 1], []) + return sum([h for h in applied.itervalues() + if h[0].special() or len(h) > 1], []) def record(ui, repo, *pats, **opts): '''interactively select changes to commit