I am trying to get familiar with python generators. I was playing with the range() function, which seems to return a range object, which my understanding is a generator. since it's a generator, then I should be able to do
a = range(10)
print(next(a))
but I get:
TypeError: 'range' object is not an iterator
why does it says it's not an iterator, since I can clearly do for i in range(10)
?