Skip to content
Discussion options

You must be logged in to vote

It's like this to express chunking and give insight into the batching and network requests that are happening under the hood.

When you have an AsyncGenerator that yields bare ObjectMeta, you never know when the next async for iteration will be already buffered or cause another network request. But when the AsyncGenerator yields Sequence[ObjectMeta], you are able to inspect the full buffering yourself. If you need more items than exist in the current sequence, then you can call anext(), but you know you're incurring a network request there.

Conversely, collect says "I want to materialize the entire list of results". So at that point you don't care how many requests it took to create it

Doe…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tooruu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants