Manually iterating through a generator (or an iterator for that matter) : Yield : Statement PYTHON TUTORIALS


PYTHON TUTORIALS » Statement » Yield »

 

Manually iterating through a generator (or an iterator for that matter)


def simpleGen():
    yield 1
    yield '2 --> punch!'

for eachItem in simpleGen():
    print eachItem



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Statement
» Yield