Hacker News new | ask | show | jobs
by dr42 5086 days ago
python's yield and the windows api yield() do quite different things, but at some abstract level, in windows 3.1 the yield() function would let the UI service the main event loop, thus keeping your ui responsive to user activity. yield in python is abstractly similar but returns control along with a reference to the generator. Why I said these are abstractly similar is because in python the yield function saves away the stack frame and restores it upon the next iteration of the generator. In this respect it's similar to windows 3.1 yield because when the event loop comes back to your process, you have a minimal 'stack' consisting of the original hwnd, along with wParam, lParam, where the lParam was a ub4 that could be used for a pointer allowing a larger 'stack frame'.
1 comments

I know they are completely different. I just thought it was curious that I have been using the same word with completely different meanings in completely different environments to similar results.