projects
/
python_utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
72d255e
)
Fix iter_utils docs.
author
Scott Gasch
<
[email protected]
>
Mon, 4 Jul 2022 07:35:35 +0000
(
00:35
-0700)
committer
Scott Gasch
<
[email protected]
>
Mon, 4 Jul 2022 07:35:35 +0000
(
00:35
-0700)
iter_utils.py
patch
|
blob
|
history
diff --git
a/iter_utils.py
b/iter_utils.py
index 897493d22cedd1e7e79263440b624535e56cbfab..00c4221b26201d7c0a3a1b5bfee938d00371d914 100644
(file)
--- a/
iter_utils.py
+++ b/
iter_utils.py
@@
-55,7
+55,7
@@
class PeekingIterator(Iterator):
class SamplingIterator(Iterator):
"""An iterator that simply echoes what source_iter produces but also
collects a random sample (of size sample_size) of the stream that can
- be queried
via get_random_sample()
at any time.
+ be queried at any time.
>>> import collections
>>> import random
@@
-68,7
+68,7
@@
class SamplingIterator(Iterator):
>>> s.__next__()
1
- >>> s
.resovoir
+ >>> s
()
[0, 1]
>>> collections.deque(s)