What's the iteration :
An object that can be used directly as a for loop is called an iterative object, and objects that can be called by Next () function, and that return the next value continuously, are called iterators, and
all iterable can be converted to iterator by the built-in function iter ().
for iterators, having a next () is enough. When you use the for and in statements, the program automatically invokes the iteration object of the object that is about to be processed, and then uses the next () method.
* * Replication Iterator * *
We need to use the deepcopy in copy.
Example:
>>> import copy
>>> i=iter (L)
>>> j=copy.deepcopy (I)
>>> Next (i)
1
>>> Next (i)
2
>>> Next (J)
1
'
* * * Generator *
Instead of saving the result in a series, the generator saves the state of the generator and returns a value each time the iteration is performed, until the stopiteration exception is encountered.
Builder function: If the yield keyword appears in a function, then the function is no longer a normal function, but a generator function.
But the generator function can produce a wireless sequence, so the list simply does not have a way to handle it.
the role of yield is to turn a function into a generator, a function with yield is no longer a normal function, and the Python interpreter treats it as a generator.
**yield and return**:
In a generator, if there is no return, the default is performed to the end of the function and returns to Stopiteration, and if you are met, throw stopiteration to terminate the iteration if it is returned during
execution.
* * Summary * *:
A builder is an iterator that can be iterated using a for loop
"'