Skip to content

Conversation

@mhvk
Copy link
Contributor

@mhvk mhvk commented Nov 4, 2025

In #30068, the deprecated style argument from array2string was removed. With that, however, all following arguments shift one up if used as positional arguments. This seems highly undesirable, as any code that used those positional arguments will now fail.

The only solution would seem to be to make those later arguments keyword-only -- which this PR does.

p.s. It seems highly unlikely that all positional arguments were used in the wild, but our code in astropy that implements __array_function__ did, and broke by #30068. We don't mind adjusting, but it seemed better to just fix the problem here.

Copy link
Member

@jorenham jorenham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from one nit this is looking good AFAIK

Comment on lines +7 to +8
This argument had no effect since Numpy 1.14.0. Any arguments following
it, such as ``formatter`` have now been made keyword-only.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This argument had no effect since Numpy 1.14.0. Any arguments following
it, such as ``formatter`` have now been made keyword-only.
This argument had no effect since Numpy 1.14.0. The parameters following
it, such as ``formatter``, have now been made keyword-only.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle happy to change, but it is called *args, **kwargs, so I'm confused why one would write parameter instead of argument (even if "argument" maybe applies to what we are having -- a friendly one -- rather than computer code...).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, basically, an argument is what you pass a parameter. So the parameter is how you define it, and the argument is how you use it.

@charris charris merged commit bf56676 into numpy:main Nov 11, 2025
84 of 85 checks passed
@charris
Copy link
Member

charris commented Nov 11, 2025

Thanks Marten.

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.

3 participants