Skip to content

Commit 5644a7d

Browse files
committed
-
1 parent fddeb63 commit 5644a7d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

source_py3/python_toolbox/cute_iter_tools.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,8 @@ def _iter_with(iterable, context_manager):
194194

195195
with context_manager:
196196
next_item = next(iterator)
197-
# You may notice that we are not `except`ing a `StopIteration`
198-
# here; If we get one, it'll just get propagated and end *this*
199-
# iterator. todo: I just realized this will probably cause a bug
200-
# where `__exit__` will get the `StopIteration`! Make failing tests
201-
# and fix.
197+
# Recycling `StopIteration` exception. (Assuming the context
198+
# manager doesn't have special treatment for it.)
202199

203200
yield next_item
204201

@@ -218,12 +215,15 @@ def get_items(iterable, n, container_type=tuple):
218215

219216
def double_filter(filter_function, iterable, lazy_tuple=False):
220217
'''
221-
Filter an `iterable` into two lists according to a `filter_function`.
218+
Filter an `iterable` into two iterables according to a `filter_function`.
222219
223220
This is similar to the builtin `filter`, except it returns a tuple of two
224221
iterators, the first iterating on items that passed the filter function,
225222
and the second iterating on items that didn't.
226223
224+
Note that this function is not thread-safe. (You may not consume the two
225+
iterators on two separate threads.)
226+
227227
If `lazy_tuple=True`, returns a `LazyTuple` rather than an iterator.
228228
'''
229229
iterator = iter(iterable)

source_py3/python_toolbox/version_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
'''
99

1010
from operator import itemgetter as _itemgetter
11-
from python_toolbox.nifty_collections import OrderedDict
1211

1312

1413
class VersionInfo(tuple):
@@ -57,6 +56,7 @@ def _asdict(self):
5756
'''
5857
Return a new `OrderedDict` which maps field names to their values.
5958
'''
59+
from python_toolbox.nifty_collections import OrderedDict
6060
return OrderedDict(zip(self._fields, self))
6161

6262

0 commit comments

Comments
 (0)