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


Groups > comp.lang.python > #43032

with ignored

From Barrett Lewis <musikal.fusion@gmail.com>
Date 2013-04-07 17:40 -0700
Subject with ignored
Newsgroups comp.lang.python
Message-ID <mailman.261.1365381639.3114.python-list@python.org> (permalink)

Show all headers | View raw


[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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web