Skip to content

Commit 8c1a6ef

Browse files
authored
Merge pull request #1071 from more-itertools/version-10.8.0
Version 10.8.0
2 parents a80f1c5 + 24be440 commit 8c1a6ef

File tree

6 files changed

+48
-13
lines changed

6 files changed

+48
-13
lines changed

README.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Python iterables.
6060
| | `interleave <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.interleave>`_, |
6161
| | `interleave_longest <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.interleave_longest>`_, |
6262
| | `interleave_evenly <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.interleave_evenly>`_, |
63+
| | `interleave_randomly <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.interleave_randomly>`_, |
6364
| | `zip_offset <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.zip_offset>`_, |
6465
| | `zip_equal <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.zip_equal>`_, |
6566
| | `zip_broadcast <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.zip_broadcast>`_, |
@@ -70,7 +71,6 @@ Python iterables.
7071
| | `partial_product <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.partial_product>`_ |
7172
+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
7273
| Summarizing | `ilen <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.ilen>`_, |
73-
| | `extract <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.extract>`_, |
7474
| | `unique_to_each <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.unique_to_each>`_, |
7575
| | `sample <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.sample>`_, |
7676
| | `consecutive_groups <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.consecutive_groups>`_, |
@@ -81,6 +81,8 @@ Python iterables.
8181
| | `is_sorted <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.is_sorted>`_, |
8282
| | `all_equal <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.all_equal>`_, |
8383
| | `all_unique <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.all_unique>`_, |
84+
| | `argmin <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.argmin>`_, |
85+
| | `argmax <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.argmax>`_, |
8486
| | `minmax <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.minmax>`_, |
8587
| | `first_true <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.first_true>`_, |
8688
| | `quantify <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.quantify>`_, |
@@ -100,6 +102,7 @@ Python iterables.
100102
| | `filter_map <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.filter_map>`_, |
101103
| | `iter_suppress <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.iter_suppress>`_, |
102104
| | `nth_or_last <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.nth_or_last>`_, |
105+
| | `extract <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.extract>`_, |
103106
| | `unique_in_window <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.unique_in_window>`_, |
104107
| | `before_and_after <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.before_and_after>`_, |
105108
| | `nth <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.nth>`_, |

docs/api.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ These tools combine multiple iterables.
118118
.. autofunction:: interleave
119119
.. autofunction:: interleave_longest
120120
.. autofunction:: interleave_evenly
121+
.. autofunction:: interleave_randomly
121122
.. autofunction:: partial_product
122123
.. autofunction:: sort_together
123124
.. autofunction:: value_chain
@@ -144,7 +145,6 @@ These tools return summarized or aggregated data from an iterable.
144145
**New itertools**
145146

146147
.. autofunction:: ilen
147-
.. autofunction:: extract
148148
.. autofunction:: unique_to_each
149149
.. autofunction:: sample(iterable, k=1, weights=None)
150150
.. autofunction:: consecutive_groups(iterable, ordering=lambda x: x)
@@ -195,6 +195,7 @@ These tools yield certain items from an iterable.
195195
.. autofunction:: filter_map
196196
.. autofunction:: iter_suppress
197197
.. autofunction:: nth_or_last(iterable, n[, default])
198+
.. autofunction:: extract
198199
.. autofunction:: unique_in_window
199200
.. autofunction:: duplicates_everseen
200201
.. autofunction:: duplicates_justseen

docs/versions.rst

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,36 @@ Version History
55
.. automodule:: more_itertools
66
:noindex:
77

8+
10.8.0
9+
------
10+
11+
* New functions:
12+
* :func:`derangements` was added (thanks to debruijn)
13+
* :func:`argmin` and :func:`argmax` were added (thanks to rhettinger)
14+
* :func:`running_median` was added (thanks to rhettinger)
15+
* :func:`extract` was added (thanks to rhettinger)
16+
* :func:`interleave_randomly` was added (thanks to ktbarrett)
17+
18+
* Changes to existing functions:
19+
* The type hints and docstring for :func:`batched` were improved (thanks to qobilidop and inventshah)
20+
* The memory usage of :func:`islice_extended` was reduced (thanks to ben42code)
21+
* The performance of :func:`sample` and :func:`consecutive_groups`, :func:`dft`, :func:`idft`, :func:`map_if`, :func:`count_cycle`, and :func:`tail` were improved (thanks to rhettinger)
22+
* The performance of :func:`before_and_after`, :func:`mark_ends`, and :func:`interleave_longest` were improved (thanks to pochmann3)
23+
* :func:`nth_prime` now accepts an ``approximate`` keyword. When set to ``True``, a faster but less accurate method is used to return a result. (thanks to rhettinger)
24+
* :func:`last` now works when its input has ``__reversed__`` set to ``None`` (thanks to inventshah)
25+
* The :func:`unzip` function was simplified (thanks to pochmann3)
26+
* The :func:`reshape` function now accepts ``shape`` values that represent multidimensional matrices (thanks to rhettinger)
27+
28+
* Other changes:
29+
* An issue with dark themes and documentation display was fixed (thanks to pochmann3, moreati, and pradyunsg)
30+
* Variable names in several functions were improved (thanks to rhettinger)
31+
* The docstrings for :func:`dft`, :func:`idft`, :func:`minmax`, :func:`sample`, and :func:`multinomial` were improved (thanks to rhettinger)
32+
* Packaging and package index metadata were improved (thanks to cdce8p)
33+
* Several aspects of the documentation were improved (thanks to rhettinger, saadmanrafat)
34+
* The Makefile now refers to `python` instead of `python3` (thanks to ktbarrett)
35+
* Test coverage was improved (thanks to rhettinger)
36+
* Python 3.14 is now tested by GitHub Actions
37+
838
10.7.0
939
------
1040

@@ -780,4 +810,4 @@ Replace it with standard ``with`` statement context management:
780810
-----
781811

782812
* Initial release, with ``collate``, ``peekable``, and ``chunked``. Could
783-
really use better docs.
813+
really use better docs.

more_itertools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
from .more import * # noqa
44
from .recipes import * # noqa
55

6-
__version__ = '10.7.0'
6+
__version__ = '10.8.0'

more_itertools/more.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,8 @@ def raise_(exception, *args):
634634
def strictly_n(iterable, n, too_short=None, too_long=None):
635635
"""Validate that *iterable* has exactly *n* items and return them if
636636
it does. If it has fewer than *n* items, call function *too_short*
637-
with those items. If it has more than *n* items, call function
638-
*too_long* with the first ``n + 1`` items.
637+
with the actual number of items. If it has more than *n* items, call function
638+
*too_long* with the number ``n + 1``.
639639
640640
>>> iterable = ['a', 'b', 'c', 'd']
641641
>>> n = 4
@@ -1331,15 +1331,16 @@ def interleave_evenly(iterables, lengths=None):
13311331

13321332

13331333
def interleave_randomly(*iterables):
1334-
"""Return a new iterable randomly selecting from each iterable,
1335-
until all iterables are exhausted.
1336-
1337-
The relative order of the elements in each iterable is preserved,
1338-
but the order with respect to other iterables is randomized.
1334+
"""Repeatedly select one of the input *iterables* at random and yield the next
1335+
item from it.
13391336
13401337
>>> iterables = [1, 2, 3], 'abc', (True, False, None)
13411338
>>> list(interleave_randomly(*iterables)) # doctest: +SKIP
13421339
['a', 'b', 1, 'c', True, False, None, 2, 3]
1340+
1341+
The relative order of the items in each input iterable will preserved. Note the
1342+
sequences of items with this property are not equally likely to be generated.
1343+
13431344
"""
13441345
iterators = [iter(e) for e in iterables]
13451346
while iterators:
@@ -5181,7 +5182,7 @@ def nth_prime(n, *, approximate=False):
51815182
>>> nth_prime(100)
51825183
547
51835184
5184-
If *approximate* is set to True, will return a prime in the close
5185+
If *approximate* is set to True, will return a prime close
51855186
to the nth prime. The estimation is much faster than computing
51865187
an exact result.
51875188

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 10.7.0
2+
current_version = 10.8.0
33
commit = True
44
tag = False
55
files = more_itertools/__init__.py

0 commit comments

Comments
 (0)