with ignored

Barrett Lewis musikal.fusion at gmail.com
Sun Apr 7 20:40:11 EDT 2013


I was recently watching that Raymond Hettinger video on creating Beautiful
Python from this years PyCon.
He mentioned pushing up the new idiom

with ignored(<ignored_exceptions>):
     # do some work

I tracked down his commit here http://hg.python.org/cpython/rev/406b47c64480

But am unsure how the yield works in the given situation.

I know about creating generators with yield and have read the docs on how
it maintains state.

I think it works because it is returning control back to the caller
while maintaining the try so if the caller throws it is caught by the
context. Is this correct? I would love an in depth explanation of how this
is working. I am trying to learn as much as possible about the actual
python internals.

Thanks in advance!
-Barrett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130407/5c944802/attachment.html>


More information about the Python-list mailing list