I think it is mostly the idea that, in programming languages, loops of any sort cannot be assigned to variables, because I guess there is some deterministic notion associated to variables that loops can lack. Your example is a special case, in the sense that the structure is pretty simple and that you include the keyword yield. So yes, your example could be valid, but then it would mean that some loops could be assigned to variables and not others, which lacks consistency. Python makes up for that in the sense of list comprehensions and generators (your first snippet) for example. In these cases, the loops are actually encapsulated in some sort of a parent object, which gives them a more deterministic, or bounded, aspect. And indeed, not any loop can be part of a generator or a list comprehension, which nicely provides a special status to those loops like yours which could pretend to be assigned to variables.