https://github.com/python/cpython/commit/818b6a9eadb7c606bc3faab91de4a76bde66a9ae
commit: 818b6a9eadb7c606bc3faab91de4a76bde66a9ae
branch: main
author: Raymond Hettinger <[email protected]>
committer: rhettinger <[email protected]>
date: 2025-04-15T11:50:52-05:00
summary:
Fix argument order in multinomial() example (gh-132557)
files:
M Doc/library/itertools.rst
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index 61e413b63cdfbe..438f3db60c396d 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -1129,8 +1129,8 @@ The following recipes have a more mathematical flavor:
def multinomial(*counts):
"Number of distinct arrangements of a multiset."
- # Counter('abracadabra').values() -> 5 2 1 1 2
- # multinomial(5, 2, 1, 1, 2) → 83160
+ # Counter('abracadabra').values() → 5 2 2 1 1
+ # multinomial(5, 2, 2, 1, 1) → 83160
return prod(map(comb, accumulate(counts), counts))
@@ -1736,7 +1736,7 @@ The following recipes have a more mathematical flavor:
>>> ''.join(it)
'DEF1'
- >>> multinomial(5, 2, 1, 1, 2)
+ >>> multinomial(5, 2, 2, 1, 1)
83160
>>> word = 'coffee'
>>> multinomial(*Counter(word).values()) == len(set(permutations(word)))
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]