Latest articles tagged cPython

Teaser image

It hit me recently that I didn't understand something about how generator functions in Python work. In short, I was unsure exactly when and how they are determined by a Python implementation to be generators as opposed to "standard" functions, i.e. a function ending in return (whether explicit or falling off the end of the function).1 That question may not make very much sense at this point, but I'm not sure how to succintly word it without background information. To that end, there are three key facts about generator functions that led me to this question, described below. Read more...