-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
BUG: meshgrid return type depends on the value of copy #30641
Copy link
Copy link
Closed
Labels
Milestone
Description
Describe the issue:
meshgrid is documented to return a tuple of arrays (since numpy 2.0) but seems to return a list if copy=False:
Reproduce the code example:
In [1]: import numpy as np
In [2]: x, indexing, sparse, copy = np.array([0, 1]), 'xy', True, False
In [3]: np.meshgrid(x, indexing=indexing, sparse=sparse, copy=copy)
Out[3]: [array([0, 1])]
In [4]: np.meshgrid(indexing=indexing, sparse=sparse, copy=copy)
Out[4]: []
In [5]: np.meshgrid([1, 2], [3, 4], indexing=indexing, sparse=sparse, copy=copy)
Out[5]:
[array([[1, 2]]),
array([[3],
[4]])]
In [8]: np.meshgrid([1, 2], [3, 4], indexing=indexing, sparse=sparse, copy=True)
Out[8]:
(array([[1, 2]]),
array([[3],
[4]]))Error message:
Python and NumPy Versions:
2.5.0.dev0+git20260111.89776e2
3.12.10 | packaged by conda-forge | (main, Apr 10 2025, 22:21:13) [GCC 13.3.0]
Runtime Environment:
No response
How does this issue affect you or how did you find it:
Reactions are currently unavailable