I recently I have been digging around the python docs and trying to gain a better understanding of python internals. One thing that I am having trouble understating is python iterators.
I have read a lot of the previous stack posts about these which seem to be similar to other information on the net, which explains how methods like iter() and next() work and how to make a custom object iterable but what I can seem to understand is how python work "under the hood" with these.
As an example if I have a list of random numbers
L=[1000,2202,3456]
I then create a list_iterator object via the iter() method, as shown below.
it = iter(L)
This bring me to my main question:
- dose the iterator ref the list obj in memory then when next is called it move on to the next ref where the number in this case is stored in memory?
At present my memory management knowledge of python is a little superficial which maybe why I not understanding properly how iterators in python work. But if anyone could clear this up I thank you in advance.