Search notes:

Python: iterator

An iterator provides data-items to its user, one at a time.
The next item is returned by calling the iterator's __next__ method.
__next__ throws a StopIteration exception when there are no more items to be returned.
Python provides the next(iter) built-in function that calls iter.__next__() under the hood and passes the returned value to the callor of next().
An iterator is also required to implement the __iter__() method which returns the iterator itself.
An iterator is different from a container object (such as list) in that the iterator only allows to be iterated over once while the __iter()__ method of a list returns a new iterator and thus can be iterated over multiple times.

See also

If an iterable is passed to iter(), iter() returns an iterator for that iterable.
Other Built-in types

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758203817, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Python/types/iterator/index(54): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78