What do you know about iterator protocol?



What do you know about iterator protocol?..

Answer / Ajit Kumar Pandey

Iterator Protocol is a set of methods in Python that allows an object to be iterated upon. An iterator has the methods __iter__() and __next__(). The __iter__() method returns an iterator object, and the __next__() method returns the next item from the iterator.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

What is difference between match & search in regex module in python?

1 Answers  


How can you find length of a tuple in python?

1 Answers  


As python is more suitable for the server-side application, it is very important to have threading implemented in your server code. How can you achieve that in python?

1 Answers  


Have you heard of the yield keyword in python?

1 Answers  


How do you find the number of references pointing to a particular object?

1 Answers  


How the string does get converted to a number?

1 Answers  


Why do we need the __init__() function in classes? What else helps?

1 Answers  


What do you mean by *args and **kwargs?

1 Answers  


Does python have class?

1 Answers  


Is python faster than python2?

1 Answers  


How can you unsign or delete variable in python?

1 Answers  


Can a constructor be static?

1 Answers  


Categories