summaryrefslogtreecommitdiff
path: root/numpy/lib/recfunctions.py
diff options
context:
space:
mode:
authornjsmith <njs@pobox.com>2013-04-13 01:12:03 -0700
committernjsmith <njs@pobox.com>2013-04-13 01:12:03 -0700
commit74b08b3f0284d9d2dd55a15dd98a3846913b1b51 (patch)
tree4e889cf226ba5b1ff3c708bfcd349352bfe76b96 /numpy/lib/recfunctions.py
parent06066cb01962819c9590d87ea57c77db2a306266 (diff)
parent5de56efaad908f2b731a7eda2b9ca2a9196f820a (diff)
downloadnumpy-74b08b3f0284d9d2dd55a15dd98a3846913b1b51.tar.gz
Merge pull request #3236 from charris/2to3-apply-itertools
2to3: Apply itertools fixer.
Diffstat (limited to 'numpy/lib/recfunctions.py')
-rw-r--r--numpy/lib/recfunctions.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/numpy/lib/recfunctions.py b/numpy/lib/recfunctions.py
index f909a4838..349d1996e 100644
--- a/numpy/lib/recfunctions.py
+++ b/numpy/lib/recfunctions.py
@@ -16,6 +16,11 @@ from numpy.ma import MaskedArray
from numpy.ma.mrecords import MaskedRecords
from numpy.lib._iotools import _is_string_like
+if sys.version_info[0] >= 3:
+ izip = zip
+else:
+ izip = itertools.izip
+
_check_fill_value = np.ma.core._check_fill_value
__all__ = ['append_fields',
@@ -287,7 +292,7 @@ def izip_records(seqarrays, fill_value=None, flatten=True):
zipfunc = _izip_fields
#
try:
- for tup in itertools.izip(*iters):
+ for tup in izip(*iters):
yield tuple(zipfunc(tup))
except IndexError:
pass
@@ -412,7 +417,7 @@ def merge_arrays(seqarrays,
seqmask = []
# If we expect some kind of MaskedArray, make a special loop.
if usemask:
- for (a, n) in itertools.izip(seqarrays, sizes):
+ for (a, n) in izip(seqarrays, sizes):
nbmissing = (maxlength - n)
# Get the data and mask
data = a.ravel().__array__()
@@ -441,7 +446,7 @@ def merge_arrays(seqarrays,
output = output.view(MaskedRecords)
else:
# Same as before, without the mask we don't need...
- for (a, n) in itertools.izip(seqarrays, sizes):
+ for (a, n) in izip(seqarrays, sizes):
nbmissing = (maxlength - n)
data = a.ravel().__array__()
if nbmissing: