From a84c097c108facafe3fa65ce903729c15fb10231 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Wed, 6 Jun 2018 18:21:15 +0100 Subject: [PATCH] py23: alias itertools.izip as 'zip' so we consistently use python3 zip iterator on both py2 and py3 --- Lib/fontTools/misc/py23.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Lib/fontTools/misc/py23.py b/Lib/fontTools/misc/py23.py index 5172c52e5..2830d4118 100644 --- a/Lib/fontTools/misc/py23.py +++ b/Lib/fontTools/misc/py23.py @@ -250,7 +250,7 @@ def open(file, mode='r', buffering=-1, encoding=None, errors=None, file, mode, buffering, encoding, errors, newline, closefd) -# always use iterator for 'range' on both py 2 and 3 +# always use iterator for 'range' and 'zip' on both py 2 and 3 try: range = xrange except NameError: @@ -259,6 +259,11 @@ except NameError: def xrange(*args, **kwargs): raise Py23Error("'xrange' is not defined. Use 'range' instead.") +try: + from itertools import izip as zip +except ImportError: + zip = zip + import math as _math