Replies: 4 comments 3 replies
-
I believe this was for expediency in the initial support since all the MATLAB stuff only had the singular format. I agree that the current support is overly restrictive. Typing may help here since it can statically check that we support the input types we claim to. We can probably support general iterables (but I'd have to look more closely). We probably could steal numpy's generic type for things they can coerce into an array, or create our own index type based on the integer restriction. Will probably want to create some utility around this to reduce code duplication. I think the fact we support lists for exclude_dims but not dims is accidental. |
Beta Was this translation helpful? Give feedback.
-
I was going to post a separate comment about this. It's really confusing to me to understand when an np array is needed versus just a list or a tuple. |
Beta Was this translation helpful? Give feedback.
-
Situations
|
Beta Was this translation helpful? Give feedback.
-
We merged a PR that made our lists of indices much more flexible. I think anywhere we've missed can be managed via follow up issues. |
Beta Was this translation helpful? Give feedback.
-
There are a lot of places where we need lists of integers/indices, and the current APIs require using
np.array
.I think we should allow either lists or np.arrays in such cases? For example, consider the following code:
The fact that the latter does not work may be confusing for users, as it is not consistent.
Allow for lists or np.array also leads to more readable code when using lists.
Beta Was this translation helpful? Give feedback.
All reactions