[issue5139] Add combinatoric counting functions to the math module.
Mark Dickinson
report at bugs.python.org
Wed Feb 4 10:36:22 CET 2009
Mark Dickinson <dickinsm at gmail.com> added the comment:
> I suggested to include math.npermutations_with_repetitions for
> completeness,
Ezio, itertools currently has combinations with and without *replacement*, not repetition. I think
you're talking about something slightly different (repetitions in the *iterable*, rather than allowing
repeated *drawings* of the same element). itertools already has 'permutations_with_replacement': it's
called 'product'.
combinations(it, r): select r elements from it, no replacement, no order
permutations(it, r): select r elements, no replacement, order is relevant
combinations_with_replacement(it, r): replacement, no order
product(it, repeat=r): replacement, order
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5139>
_______________________________________
More information about the Python-bugs-list
mailing list