Dennis Sweeney <[email protected]> added the comment:
How is proposed_function("abcd", max_repeat=3) any different from what you can
currently spell as combinations("aaabbbcccddd") ? Or, more generally,
def proposed_function(it, repeats)
repeated = chain.from_iterable([x] * repeat for x in it)
return combinations(repeated)
This can easily generalize to specifying the max count of each item.
----------
nosy: +Dennis Sweeney
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue44197>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com