3 ms·
Why yield is not a suffix operator like await?
by laerus 3y ago
Why yield is not a suffix operator like await?
- Georgelemental 3y ago`.await` being postfix makes it easy to chain with further method calls (eg `foo().await.bar().await`). `yield expr` returns `()`, so there is no use in chaining it.
- laerus 3y agoThanks for the explanation. I was thinking of Python's yield were it evaluates to what is .send() back in the generator.