Not all generators containing await are compiled to async generators
#114104
Labels
docs
Documentation in the Doc dir
await are compiled to async generators
#114104
Documentation
A generator of the form
f(x) for x in await afirst awaitsaand then creates a regular syncgenerator, as can be seen in the following minimal reproducer:However the python language reference 6.2.8. Generator expressions states:
This seems to suggest that the generator
f(x) for x in await adoes contain an await expression, so it should become anasync_generator? However there is also:This seems to hint at an implementation detail that the leftmost
forclause has special treatment and is always evaluated before the generator is constructed, but the interactions withawaitare unclear from this, especially whether this disqualifies the generator from becoming async.I don't know whether this is an undocumented feature or a bug.
The text was updated successfully, but these errors were encountered: