-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Align typing of dimension inputs #7094
Comments
Iterables (implement See https://docs.python.org/3.9/library/collections.abc.html#collections-abstract-base-classes |
Yes, sequence sounds right if the order matters. A bit unfortunate that |
We can build a list if we need a len? Or IIRC there is a |
We already do that. We have the following solutions:
|
Ah excellent, thanks @headtr1ck |
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:
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 a
str | Sequence[Hashable]
(a numpy.ndarray is not a Sequence, but who uses this for dimensions anyway?).The text was updated successfully, but these errors were encountered: