There are only slight differences in the two. You can use the dis module to examine this sort of thing for yourself. Edit: My first version decompiled the generator expression created at module-scope in the interactive prompt. That's slightly different from the OP's version with it used inside a function. I've modified this to match the actual case in the question. As you can see below, the "yield

