diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-04-12 20:10:58 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-04-12 21:22:36 -0600 |
commit | 5de56efaad908f2b731a7eda2b9ca2a9196f820a (patch) | |
tree | 4e889cf226ba5b1ff3c708bfcd349352bfe76b96 /numpy/lib/npyio.py | |
parent | 06066cb01962819c9590d87ea57c77db2a306266 (diff) | |
download | numpy-5de56efaad908f2b731a7eda2b9ca2a9196f820a.tar.gz |
2to3: Apply itertools fixer.
In Python 3 zip, map, and filter are all iterators, consequently the
itertools variants izip, imap, and ifilter have been removed and the
itertools fixer replaces them with the unprefixed names.
Because the places where the iterator variants are used in current look
like places where the iterator version might be useful, the approach
taken here is to define the prefixed versions to the unprefixed versions
for Python 3, but otherwise import them from itertools.
Closes #3233.
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r-- | numpy/lib/npyio.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index 600ab4a36..ea8d98656 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -24,8 +24,10 @@ from io import BytesIO if sys.version_info[0] >= 3: import pickle + imap = map else: import cPickle as pickle + imap = itertools.imap loads = pickle.loads @@ -1607,7 +1609,7 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None, converter.iterupgrade(current_column) except ConverterLockError: errmsg = "Converter #%i is locked and cannot be upgraded: " % i - current_column = itertools.imap(itemgetter(i), rows) + current_column = imap(itemgetter(i), rows) for (j, value) in enumerate(current_column): try: converter.upgrade(value) |