From the following page (http://code.google.com/p/appengine-pipeline/wiki/GettingStarted) I have seen the following code in an example of how to use the AppEngine pipeline:
class AddOne(pipeline.Pipeline):
def run(self, number):
return number + 1
class AddTwoAndLog(pipeline.Pipeline):
def run(self, number):
result = yield AddOne(number)
final_result = yield AddOne(result)
yield LogMessage('The value is: %d', final_result) # Works
My question/confusion is about the yield statement on the right side of the “=”. Is this standard python syntax/usage, or is this special case that is only allowed/used with the Pipeline model? What is happening here?
Assigning from a
yieldis standard as of Python 2.5. It enables coroutines.See http://docs.python.org/whatsnew/2.5.html#pep-342-new-generator-features