From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 15 Apr 2025 16:56:57 +0000 (+0200) Subject: [3.13] Fix argument order in multinomial() example (gh-132557) (gh-132560) X-Git-Tag: v3.13.4~270 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11617d5a7f91256a59974c38114ec5f4ebf540e7;p=thirdparty%2FPython%2Fcpython.git [3.13] Fix argument order in multinomial() example (gh-132557) (gh-132560) --- diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index 8e78ae9cc00f..f996a365d56b 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)))