Reputation: 8055
I am planning to write this function to yield all integers between two numbers, just like python3 range
class.
I already wrote this function like this:
def gen_numbers(start,end):
counter = start
while counter <= end:
yield counter
counter += 1
but if any built-in function already exists, tell me to use it!
Upvotes: 1
Views: 811
Reputation: 62908
Yes, xrange returns an xrange object. Does it have to be specifically a generator?
Upvotes: 9