Tim Peters <t...@python.org> added the comment:

Dennis, combinations("aaabbbcccddd") isn't a valid call - the function requires 
a "how many?" argument too. If, e.g., we were asking for groups of 4, then 
combinations("aaabbbcccddd", 4) generates the 4-tuple ('a', 'b', 'c', 'd') 81 
(3**4) times, while the OP presumably only wants to get it once.

OTOH, combinations_with_replacement("abcd", 4) can generate tuples with more 
than 3 repetitions of a given element.

The linked StackOverflow entry gives an efficient "real solution", but I agree 
with its author's final comment: "It is much too specialized for itertools". 
Indeed, it seems too obscure and special-purpose to me to even qualify as a 
reasonable candidate for an itertools doc "recipe".

----------
nosy: +tim.peters

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44197>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to