mirror of
https://github.com/python/cpython.git
synced 2025-09-25 01:43:11 +00:00
Issue #16394: Note the tee() pure python equivalent is only a rough approximation.
This commit is contained in:
parent
cd9b5c2f40
commit
ab425aa9d3
1 changed files with 4 additions and 1 deletions
|
@ -588,7 +588,10 @@ loops that truncate the stream.
|
||||||
|
|
||||||
.. function:: tee(iterable, n=2)
|
.. function:: tee(iterable, n=2)
|
||||||
|
|
||||||
Return *n* independent iterators from a single iterable. Equivalent to::
|
Return *n* independent iterators from a single iterable.
|
||||||
|
|
||||||
|
The following Python code helps explain what *tee* does (although the actual
|
||||||
|
implementation is more complex and uses only a single underlying FIFO queue)::
|
||||||
|
|
||||||
def tee(iterable, n=2):
|
def tee(iterable, n=2):
|
||||||
it = iter(iterable)
|
it = iter(iterable)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue