You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function which returns the number of ways to choose k items from n items without repetition and without order was added in bpo-35431. This functions is always goes in pair with other function, which returns the number of ways to choose k items from n items without repetition and with order. These functions are always learned together in curses of combinatorics. Often C(n,k) is determined via P(n,k) (and both are determined via factorial).
P(n, k) = n! / (n-k)!
C(n, k) = P(n, k) / k!
The proposed PR adds meth.perm(). It shares most of the code with math.comb().
+0 from me. It is inevitable that this will be requested now that we have comb().
Exactly my thoughts, too. I don't think I'll have any use for math.perm; the main reason to add it will be to satisfy all those who got taught combinations and permutations at the same time, see them as a unit, and then get surprised when they find math.comb without math.perm.
The good part is that now that we have math.comb, I think everything about the API of math.perm is already clear (including what to call it).
Activity
serhiy-storchaka commentedon Jun 1, 2019
The function which returns the number of ways to choose k items from n items without repetition and without order was added in bpo-35431. This functions is always goes in pair with other function, which returns the number of ways to choose k items from n items without repetition and with order. These functions are always learned together in curses of combinatorics. Often C(n,k) is determined via P(n,k) (and both are determined via factorial).
The proposed PR adds meth.perm(). It shares most of the code with math.comb().
rhettinger commentedon Jun 1, 2019
+0 from me. It is inevitable that this will be requested now that we have comb(). The need for this is much less though.
mdickinson commentedon Jun 1, 2019
Exactly my thoughts, too. I don't think I'll have any use for
math.perm; the main reason to add it will be to satisfy all those who got taught combinations and permutations at the same time, see them as a unit, and then get surprised when they findmath.combwithoutmath.perm.The good part is that now that we have math.comb, I think everything about the API of math.perm is already clear (including what to call it).
serhiy-storchaka commentedon Jun 2, 2019
New changeset 5ae299a by Serhiy Storchaka in branch 'master':
bpo-37128: Add math.perm(). (GH-13731)
5ae299a