Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #43032 > unrolled thread

with ignored

Started byBarrett Lewis <musikal.fusion@gmail.com>
First post2013-04-07 17:40 -0700
Last post2013-04-07 17:40 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  with ignored Barrett Lewis <musikal.fusion@gmail.com> - 2013-04-07 17:40 -0700

#43032 — with ignored

FromBarrett Lewis <musikal.fusion@gmail.com>
Date2013-04-07 17:40 -0700
Subjectwith ignored
Message-ID<mailman.261.1365381639.3114.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web