diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-04-09 12:44:24 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-04-10 16:41:13 -0600 |
commit | a6164794a63215e23fa28432d9acec4727c68d02 (patch) | |
tree | e1f1cb2da6aac69cb3410b623fcf224ec433d1a4 /numpy/lib/recfunctions.py | |
parent | f85bdf48aadf7b5a5f575370b589805fed190a6c (diff) | |
download | numpy-a6164794a63215e23fa28432d9acec4727c68d02.tar.gz |
2to3: Apply `map` fixer.
In Python 3 `map` is an iterator while in Python 2 it returns a list.
The simple fix applied by the fixer is to inclose all instances of map
with `list(...)`. This is not needed in all cases, and even where
appropriate list comprehensions may be preferred for their clarity.
Consequently, this patch attempts to use list comprehensions where it
makes sense.
When the mapped function has two arguments there is another problem that
can arise. In Python 3 map stops execution when the shortest argument
list is exhausted, while in Python 2 it stops when the longest argument
list is exhausted. Consequently the two argument case might need special
care. However, we have been running Python3 converted versions of numpy
since 1.5 without problems, so it is probably not something that affects
us.
Closes #3068
Diffstat (limited to 'numpy/lib/recfunctions.py')
-rw-r--r-- | numpy/lib/recfunctions.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/lib/recfunctions.py b/numpy/lib/recfunctions.py index a9f480f5d..f909a4838 100644 --- a/numpy/lib/recfunctions.py +++ b/numpy/lib/recfunctions.py @@ -401,7 +401,7 @@ def merge_arrays(seqarrays, seqarrays = (seqarrays,) else: # Make sure we have arrays in the input sequence - seqarrays = map(np.asanyarray, seqarrays) + seqarrays = [np.asanyarray(_m) for _m in seqarrays] # Find the sizes of the inputs and their maximum sizes = tuple(a.size for a in seqarrays) maxlength = max(sizes) |