Python Iterators: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 8: Line 8:
An iterator instance represents a stream of data.  
An iterator instance represents a stream of data.  


The iterator instances are created from iterable objects with the built-in function <code>[[Python Language Functions#iter|iter()]]</code>
The iterator instances are created from [[Python_Language#Iterable_Types|iterable objects]] with the built-in function <code>[[Python Language Functions#iter|iter()]]</code>:
 
<syntaxhighlight lang='py'>
l = ['a', 'b', 'c']
i = iter(l)
</syntaxhighlight>

Revision as of 04:56, 7 July 2022

External

Internal

TODO

TO PROCESS PyOOP "The Iterator Pattern" + "Iterators" + "The iterator protocol"

Overview

An iterator instance represents a stream of data.

The iterator instances are created from iterable objects with the built-in function iter():

l = ['a', 'b', 'c']
i = iter(l)