I am trying the following:
>>> i = iter([1,2,3])
>>> print(type(i))
<class 'list_iterator'>
>>> print(type(i).mro())
[<class 'list_iterator'>, <class 'object'>]
>>> j = list_iterator()
and the last lines gives me an error:
Traceback (most recent call last):
File "/home/pru/ML/stepik/examples module2/iterators.py", line 10, in <module>
j = list_iterator()
NameError: name 'list_iterator' is not defined
How come it is not defined? Wouldn't interpreter look for name 'list_iterator' in 'object' namespace?
type(i)instead, but what were you hoping to do with it?