0

For example

l1= [1,2,3,4,5]
i_l1 = iter(list)

what did the iter() function do to l1 that made i_l1 an iterator? can someone provide the source code for iter() function? Also how does the next method magically appeared in the i_l1 directory after passing l1 as an argument to iter() funtion?

  • 2
    Does this answer your question? [Build a Basic Python Iterator](https://stackoverflow.com/questions/19151/build-a-basic-python-iterator) – John Strood Jun 21 '20 at 14:13
  • The [documentation](https://docs.python.org/3/library/functions.html#iter) (also the links therein) on this seems to be fairly reasonable? – Ondrej K. Jun 21 '20 at 14:40

0 Answers0