I know what does yield do when we write say
while True:
yield i
i += 1
But what does it mean when we say
def foo():
A = yield B
? What would be the value of A then?
The reason why I asked this question is because this is how things are done in tornado: http://www.tornadoweb.org/en/stable/guide/async.html
In Tornado, I see a lot of examples saying
document = yield http_client.fetch('...')
I know document should be the content fetched by the client. By for now I'm trying to understand how it is implemented - I searched for many examples about but couldn't find any one explaining how does "A = yield B" work. By looking Tornado's source code I couldn't understand it myself. Can someone explain it to me?