Traverse a Python iterator or generator
as_iterator(x)iterate(it, f = base::identity, simplify = TRUE)
iter_next(it, completed = NULL)
For iterate(), A list or vector containing the results of calling
f on each item in x (invisibly); For iter_next(), the next
value in the iteration (or the sentinel completed value if the iteration
is complete).
Python iterator or iterable
Python iterator or generator
Function to apply to each item. By default applies the
identity function which just reflects back the value of the item.
Should the result be simplified to a vector if possible?
Sentinel value to return from iter_next() if the iteration
completes (defaults to NULL but can be any R value you specify).
Simplification is only attempted all elements are length 1 vectors of type "character", "complex", "double", "integer", or "logical".