Generators

By Collin Anderson
def regular():
    print "hello"

def generator():
    print "hello"
    yield "goodbye"
>>> regular()
hello
>>> generator()
<generator object at 0x010D0508>
>>> list(generator())
hello
['goodbye']

Found this here.

Tags: , , , ,

Leave a Reply