3 ms·
Python's generators are more magic. It's similar to some kind of COME FROM mechanism.
by lispm 9y ago
Python's generators are more magic. It's similar to some kind of COME FROM mechanism.
- viraptor 9y agoWeird comparison. Come from has no indication on the other side that it will happen. Generators are pretty explicit with yield. On the calling side they can be explicit with a next() call.
- lispm 9y agoA generator may have multiple yields, if you call next(), then it comes from that call to the last yield call - based on the current execution context. The yield waits that the execution comes back to it. The idea of function calls is much simpler - no yield magic necessary.
- deleted 9y ago[deleted]