In Python, is there any difference between creating a generator object through a generator expression versus using the yield statement?
Using yield is nice if the expression is more complicated than just nested loops. Among other things you can return a special first or special last value. Consider:
yield
def Generator(x): for i in xrange(x): yield(i) yield(None)