Skip to content

Commit 79d342a

Browse files
author
Ben Demaree
committed
Make note of num_results property on iterators
1 parent 4162351 commit 79d342a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

core/google/cloud/iterator.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@
4242
... if not my_item.is_valid:
4343
... break
4444
45+
At any point, you may check the number of items consumed by referencing the
46+
``num_results`` property of the iterator::
47+
48+
>>> my_iterator = Iterator(...)
49+
... for my_item in my_iterator:
50+
... if my_iterator.num_results >= 10:
51+
... break
52+
4553
When iterating, not every new item will send a request to the server.
4654
To iterate based on each page of items (where a page corresponds to
4755
a request)::

0 commit comments

Comments
 (0)