Fetching huge datasets using iterator protocol

Start writing hereSome times you want to retrieve a huge dataset and iterate/loop over it to perform some operation. Fetching them all into memory at once can lock up the server processes. To avoid such problems and to iterate over the dataset you may use pythons Iterator Protocol. Read the following to have an better understanding about iterators,

Python official documentation about iterators
Python practise book

While iterating over the dataset, actually python is calling the __next__

Read the entire article at the source link…

We're happy to share this resource that we found. The content displayed on this page is property of it's original author and/or their organization.

Leave a Reply