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

functools.cmp_to_key and itertools.combinations_with_replacement missing #189

Open
jayvdb opened this issue Nov 29, 2015 · 3 comments
Open

Comments

@jayvdb
Copy link

jayvdb commented Nov 29, 2015

functools.cmp_to_key and itertools.combinations_with_replacement are mentioned in https://github.com/PythonCharmers/python-future/blob/6b8341c0412ddf8081151692e9034986a6f867bc/docs/changelog.rst#new-features , however they are not mentioned anywhere else and don't appear to have been added to the repo.

@rodrigc
Copy link

rodrigc commented Sep 5, 2016

@edschofield I ran into the same problem, looking for a backport of functools.cmp_to_key, but couldn't find it. Do you have the implementation somewhere, but forgot to add it?

@edschofield
Copy link
Contributor

Thanks for the feedback. You're right ... it looks like they are missing. I haven't been able to find them in my git history either.

I have added cmp_to_key to the v0.16.x branch. Would one of you like to submit a pull request for combinations_with_replacement? I'd be happy to including it in the upcoming v0.16 release.

@jayvdb
Copy link
Author

jayvdb commented Sep 22, 2016

There are two sample implementations at https://docs.python.org/2/library/itertools.html#itertools.combinations_with_replacement

The first one is described as Roughly equivalent to:, which suggests that the first implementation is not 100% correct. :/

There are a bunch of tests in cpython which can be used to check any implementation.

$ grep def.*combinations_with_replacement cpython/Lib/test/test_itertools.py
    def test_combinations_with_replacement(self):
    def test_combinations_with_replacement_overflow(self):
    def test_combinations_with_replacement_tuple_reuse(self):
    def test_combinations_with_replacement(self):
    def test_combinations_with_replacement(self):
    def test_combinations_with_replacement_sizeof(self):

I've created #242 about whether we can borrow PSF licensed code/tests.

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

4 participants