https://github.com/python/cpython/commit/818b6a9eadb7c606bc3faab91de4a76bde66a9ae
commit: 818b6a9eadb7c606bc3faab91de4a76bde66a9ae
branch: main
author: Raymond Hettinger <rhettin...@users.noreply.github.com>
committer: rhettinger <rhettin...@users.noreply.github.com>
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 -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to