r/Python • • Mar 22 '21

Tutorial Best answer to what does yield do

https://stackoverflow.com/a/47285378/7301792
16 Upvotes

10 comments sorted by

View all comments

3

u/kkiran Mar 23 '21

Fun way to think about it - return is one time purchase whereas yield is like a gym membership, that doesn’t end unless you end!

0

u/AbstProcDo Mar 23 '21

ty, dude, I assume that imagination and metaphor helpful for our learning.