The two concepts are very similar, with the main difference being coroutines can receive arguments after invocation and generators generally cannot (here’s a good explanation if you want to get more into it). Here’s a write up about Rust’s implementation, they’re more than generators and from reading over it they may allow passing data in with each resume (I haven’t played with them in Rust, but I’ve used the concept a lot in Lua, Python, and Go).
Then again, like the second link says, the boundaries of both can vary conversation to conversation. Python generators, for example, can also be used as coroutines (see this PEP).
The section titled “what is the difference” doesn’t explain what the difference is, only what a generator is (which I already knew).
It’s essentially a name change.
The two concepts are very similar, with the main difference being coroutines can receive arguments after invocation and generators generally cannot (here’s a good explanation if you want to get more into it). Here’s a write up about Rust’s implementation, they’re more than generators and from reading over it they may allow passing data in with each resume (I haven’t played with them in Rust, but I’ve used the concept a lot in Lua, Python, and Go).
Then again, like the second link says, the boundaries of both can vary conversation to conversation. Python generators, for example, can also be used as coroutines (see this PEP).