changeset 35405:e66d6e938d2d

py3: introduce pycompat.ziplist as zip is a generator on Python 3 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. Differential Revision: https://phab.mercurial-scm.org/D1675
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 11 Dec 2017 05:56:35 +0530
parents 6ebe899b6551
children 76dcdc4e707b
files mercurial/pycompat.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/pycompat.py	Mon Dec 11 05:26:46 2017 +0530
+++ b/mercurial/pycompat.py	Mon Dec 11 05:56:35 2017 +0530
@@ -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')