From a6164794a63215e23fa28432d9acec4727c68d02 Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Tue, 9 Apr 2013 12:44:24 -0600 Subject: 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 --- numpy/matrixlib/defmatrix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/matrixlib/defmatrix.py') diff --git a/numpy/matrixlib/defmatrix.py b/numpy/matrixlib/defmatrix.py index 70f5683ff..080e83286 100644 --- a/numpy/matrixlib/defmatrix.py +++ b/numpy/matrixlib/defmatrix.py @@ -45,7 +45,7 @@ def _convert_from_string(data): newrow = [] for col in trow: temp = col.split() - newrow.extend(map(_eval,temp)) + newrow.extend(map(_eval, temp)) if count == 0: Ncols = len(newrow) elif len(newrow) != Ncols: -- cgit v1.2.1