-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
What is your issue?
Currently the input type for "one or more dims" is changing from function to function.
There are some open PRs that move to str | Iterable[Hashable]
which allows the use of tuples as dimensions.
Some changes are still required:
- Accept None in all functions that accept dims as default, this would simplify typing alot (see Add Ellipsis typehint to reductions #7048 (comment))
- Check if we can always include ellipsis "..." in dim arguments (see Add Ellipsis typehint to reductions #7048 (review))
-
Iterable[Hashable]
includes sets, which do not preserve the ordering (see Add set_xindex and drop_indexes methods #6971 (comment)).
This means we need to distinguish between the cases where the order matters (constructor, transpose etc.) and where it does not (drop_dims, reductions etc.).
Probably this needs to be typed as astr | Sequence[Hashable]
(a numpy.ndarray is not a Sequence, but who uses this for dimensions anyway?).
dcherian, max-sixty, benbovy and derhintzemax-sixty