0

https://stackoverflow.com/a/44273861/433570 says 'yield from' is old and we should learn 'await'.
But It doesn't say they are the same thing or they are different.

But I have some good book and videos which talks about yield from

Can I think yield from was replaced by await? and they are essentially the same thing?

https://www.youtube.com/watch?v=MCs5OvhV9S4

I have a book fluent python which also talks about yield from

  • Edit

When I see some good books/videos like the above talking about yield from, could I substitute yield from with await in my mind?

2

1 Answer 1

0

Yes they are the same thing. Yield is the manual way of doing async await. See https://www.python.org/dev/peps/pep-0492/#new-coroutine-declaration-syntax where they detail that async await is just a coroutine (yield) underneath

Sign up to request clarification or add additional context in comments.

1 Comment

yield and await may be similar under the hood, but they aren't the same thing, and they're not interchangeable. I had code that wasn't working with await, I replaced await with yield and suddenly the code worked fine. I'm not sure why just that change fixed it, but it has me certain that they aren't "the same thing".

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.