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

Combinations with replacement are not supported #39450

Open
1 task done
maxale opened this issue Feb 4, 2025 · 2 comments
Open
1 task done

Combinations with replacement are not supported #39450

maxale opened this issue Feb 4, 2025 · 2 comments

Comments

@maxale
Copy link
Contributor

maxale commented Feb 4, 2025

Problem Description

It appears that Combinations class does not support those with replacement, which would a nice feature to have.

Proposed Solution

Add a keyword argument like replacement= with default value False (current behavior), setting which to True will produce combinations with replacement.

Alternatives Considered

Alternative is itertools.combinations_with_replacement() function.

Additional Information

Ordered combinations with and without replacement are supported via Tuples and Permutations classes respectively.

Is there an existing issue for this?

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
@debesh00800
Copy link

debesh00800 commented Feb 6, 2025

@maxale Can I please work on this if this is not assigned yet?

@maxale
Copy link
Contributor Author

maxale commented Feb 6, 2025

@debesh00800: No need to ask, just contribute a fix if you have one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants