Answer the question
In order to leave comments, you need to log in
Were you able to show the differences between a generator and an iterator?
Before the interview, I would like to understand if I am confused in terminology. Please help with criticism.
Do I understand correctly that:
1. it should be clearly understood that there are concepts: an iterator, a generator, an iterable object
2. a generator is a special case of an iterator
3. a generator and an iterator implement the iterator interface. That is, they have methods __iter__(), __next__()
4. an iterable object has a method __iter__() that returns an iterator or generator
An example of an iterator to point 3 is here .
An example of a generator for point 3 is here .
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question