This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients Yury.Selivanov, alex, aronacher, asvetlov, eric.araujo, gcewing, ncoghlan, rfk, rhettinger, rndblnch, zbysz
Date 2011-11-23.00:55:38
SpamBayes Score 1.2989632e-06
Marked as misclassified No
Message-id <1322009739.75.0.918798970551.issue11682@psf.upfronthosting.co.za>
In-reply-to
Content
*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
History
Date User Action Args
2011-11-23 00:55:39ncoghlansetrecipients: + ncoghlan, rhettinger, gcewing, rndblnch, aronacher, eric.araujo, alex, rfk, asvetlov, zbysz, Yury.Selivanov
2011-11-23 00:55:39ncoghlansetmessageid: <1322009739.75.0.918798970551.issue11682@psf.upfronthosting.co.za>
2011-11-23 00:55:39ncoghlanlinkissue11682 messages
2011-11-23 00:55:38ncoghlancreate