Message148163
*Any* expression can be used as a standalone statement and (since PEP 352 was implemented) that now applies to 'yield' as well.
PEP 352 fundamentally changed the way yield was conceptualised within the language - thinking of it as "a statement that can be used as an expression" is just plain *wrong*. It's now just an expression that happens to have a couple of special cases in the grammar to allow the parentheses to be skipped when they're distracting rather than helpful.
That is, the only reason the yield statement still exists as a separate entity is to allow us to drop the otherwise mandatory parentheses:
(yield val) # yield expression as statement
yield val # yield statement |
|
Date |
User |
Action |
Args |
2011-11-23 00:55:39 | ncoghlan | set | recipients:
+ ncoghlan, rhettinger, gcewing, rndblnch, aronacher, eric.araujo, alex, rfk, asvetlov, zbysz, Yury.Selivanov |
2011-11-23 00:55:39 | ncoghlan | set | messageid: <1322009739.75.0.918798970551.issue11682@psf.upfronthosting.co.za> |
2011-11-23 00:55:39 | ncoghlan | link | issue11682 messages |
2011-11-23 00:55:38 | ncoghlan | create | |
|