Is it possible to yield two things at a time just like return?
You can only yield a single value at a time. Iterating over the generator will yield each value in turn.
def foo():
yield 1
yield 2
for i in foo():
print i
And as always, the value can be a tuple.
def foo():
yield 1, 2
for i in foo():
print i