mirror of
https://github.com/python/cpython.git
synced 2025-10-02 05:12:23 +00:00
GH-102653: Make recipe docstring show the correct distribution (GH-102742)
(cherry picked from commit b0ec6253c9
)
Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
This commit is contained in:
parent
0560fe3c10
commit
4a7faac557
1 changed files with 2 additions and 1 deletions
|
@ -589,7 +589,8 @@ from the combinatoric iterators in the :mod:`itertools` module:
|
|||
return tuple(pool[i] for i in indices)
|
||||
|
||||
def random_combination_with_replacement(iterable, r):
|
||||
"Random selection from itertools.combinations_with_replacement(iterable, r)"
|
||||
"Choose r elements with replacement. Order the result to match the iterable."
|
||||
# Result will be in set(itertools.combinations_with_replacement(iterable, r)).
|
||||
pool = tuple(iterable)
|
||||
n = len(pool)
|
||||
indices = sorted(random.choices(range(n), k=r))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue