Skip to content

MAINT: remove unnecessary kwargs update in MaskedArray.reshape #29403

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MarcoGorelli
Copy link
Member

I was working on the type annotations for MaskedArray.reshape and looked into the implementation, and noticed there's an unnecessary update to kwargs

The line

kwargs.update(order=kwargs.get('order', 'C'))

sets 'C' as the default if order wasn't passed, else it keeps what the user passed. This then gets passed to ndarray.reshape in

result = self._data.reshape(*s, **kwargs).view(type(self))

and

result._mask = mask.reshape(*s, **kwargs)

However, order='C' is already the default for ndarray.reshape

@array_function_dispatch(_reshape_dispatcher)
def reshape(a, /, shape=None, order='C', *, newshape=None, copy=None):

@MarcoGorelli MarcoGorelli marked this pull request as ready for review July 21, 2025 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy