D1675: py3: introduce pycompat.ziplist as zip is a generator on Python 3
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Tue Dec 12 23:26:11 UTC 2017
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
Similar to map, the return value of zip was also turned into a generator on
Python 3. We have multiple occurences in our codebase where we retrieve the
values of zip multiple times, so let's introduce pycompat.ziplist similar to
pycompat.maplist.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D1675
AFFECTED FILES
mercurial/pycompat.py
CHANGE DETAILS
diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -63,6 +63,7 @@
sysexecutable = os.fsencode(sysexecutable)
stringio = io.BytesIO
maplist = lambda *args: list(map(*args))
+ ziplist = lambda *args: list(zip(*args))
rawinput = input
# TODO: .buffer might not exist if std streams were replaced; we'll need
@@ -313,6 +314,7 @@
shlexsplit = shlex.split
stringio = cStringIO.StringIO
maplist = map
+ ziplist = zip
rawinput = raw_input
isjython = sysplatform.startswith('java')
To: pulkit, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list