summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 98b0413a1..4172c26b5 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -4530,18 +4530,14 @@ def meshgrid(*xi, **kwargs):
output[1].shape = (-1, 1) + (1,)*(ndim - 2)
shape[0], shape[1] = shape[1], shape[0]
- if sparse:
- if copy_:
- return [x.copy() for x in output]
- else:
- return output
- else:
+ if copy_:
+ output = [x.copy() for x in output]
+
+ if not sparse and len(output) > 0:
# Return the full N-D matrix (not only the 1-D vector)
- if copy_:
- mult_fact = np.ones(shape, dtype=int)
- return [x * mult_fact for x in output]
- else:
- return np.broadcast_arrays(*output)
+ output = np.broadcast_arrays(*output, subok=True)
+
+ return output
def delete(arr, obj, axis=None):