[Python-ideas] yield statements (was relaxing keyword usage restrictions)

Stefan Behnel stefan_ml at behnel.de
Sat Sep 10 18:09:42 CEST 2011

ron3200, 09.09.2011 23:34:
>         x = yield
> I really think it should have been "x = (yield)" or  "x yield None".
>        x = y               Assign x the object(s) y is assigned to.
>        x yield y           assign x from yield, yield out y

Whoa, that's ugly. It totally hides the fact that an assignment is taking 
place at all. Here, yield isn't operating on x, it's operating on y. Your 
syntax adds symmetry where there is none.

(And, BTW, I agree that the yield should always be in parentheses, but I 
guess it's too late to change that before Py4.)


More information about the Python-ideas mailing list