Skip to content

Commit 2d35a57

Browse files
rework buffering advice since list isn't comparable for async
1 parent e34d926 commit 2d35a57

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

asyncstdlib/itertools.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ class Tee(Generic[T]):
418418
the same items in the same order.
419419
All child iterators may advance separately but share the same items
420420
from ``iterable`` -- when the most advanced iterator retrieves an item,
421-
it is buffered until the least advanced iterator has yielded it as well.
421+
it is buffered until all other iterators have yielded it as well.
422422
A ``tee`` works lazily and can handle an infinite ``iterable``, provided
423423
that all iterators advance.
424424
@@ -429,10 +429,6 @@ async def derivative(sensor_data):
429429
await a.anext(previous) # advance one iterator
430430
return a.map(operator.sub, previous, current)
431431
432-
``tee`` must internally buffer each item until the last iterator has yielded it;
433-
if the most and least advanced iterator differ by most data,
434-
using a :py:class:`list` is more efficient (but not lazy).
435-
436432
If ``iterable`` is an iterator and read elsewhere, ``tee`` will generally *not*
437433
provide these items. However, a ``tee`` of a ``tee`` shares its buffer with parent,
438434
sibling and child ``tee``\ s so that each sees the same items.

0 commit comments

Comments
 (0)