Skip to content
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

MAINT: special.perm: adjustments for backward compatibility/consistency #7

Merged
merged 1 commit into from
Jun 23, 2024

Conversation

mdhaber
Copy link

@mdhaber mdhaber commented Jun 21, 2024

Reference issue

scipy#20909

What does this implement/fix?

Before scipy#20909, perm accepted lists and arrays as long as (k > N) or (N < 0) or (k < 0) worked; scipy#20909 immediately began to raise an error for non-scalar input. This changes it to be more flexible about the input unless it doesn't make sense (e.g. lists with more than one element and strings no longer work).

Also, scipy#20909 deprecated integral floats. This reverts that change for consistency with the deprecations made to comb. For instance, this still works without warning:

special.comb(np.asarray([5]), np.asarray(10).reshape(1, 1), exact=True)

so this still works without warning

special.perm(np.asarray([5]), np.asarray(10).reshape(1, 1), exact=True)

I don't think this is what we want, ultimately, but I figure that perm and comb should behave similarly so that a decision about what to do about both can be made together.

Marked as draft because I'd appreciate your thoughts rather than just merging. This is not necessarily correct; it's just trying to bring up some points that might have been overlooked.

@j-bowhay
Copy link
Owner

At a cursory look these changes look good. I am going to struggle to find the bandwidth to look in more detail in the next couple of days. I'll merge as is to see if other reviewers are able to review/are happy with this before branching, and if not, I can look in more detail when I find the time.

@j-bowhay j-bowhay marked this pull request as ready for review June 23, 2024 21:34
@j-bowhay j-bowhay merged commit beb1e73 into j-bowhay:dep_perm_iv_floats Jun 23, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants