Path: csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.064 X-Spam-Evidence: '*H*': 0.87; '*S*': 0.00; 'pycon.': 0.04; 'hettinger': 0.07; 'caller': 0.09; 'explanation': 0.09; 'generators': 0.09; 'throws': 0.09; 'python': 0.11; 'advance!': 0.16; 'situation.': 0.16; 'trying': 0.19; 'commit': 0.19; 'working.': 0.19; 'creating': 0.23; 'raymond': 0.30; 'message- id:@mail.gmail.com': 0.30; 'context.': 0.31; 'depth': 0.31; 'maintains': 0.31; 'maintaining': 0.32; 'url:python': 0.33; 'actual': 0.34; 'subject:with': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'returning': 0.36; 'yield': 0.36; 'thanks': 0.36; 'possible': 0.36; 'url:org': 0.36; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'read': 0.60; 'mentioned': 0.61; 'new': 0.61; 'back': 0.62; '8bit%:10': 0.64; 'love': 0.65; 'here': 0.66; 'beautiful': 0.68; 'watching': 0.68; 'idiom': 0.84; 'url:cpython': 0.84; 'url:rev': 0.84; 'state.': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:from:date:message-id:subject:to :content-type; bh=BNCsHokljsipsHsmhnDr7EFS5rb4nkxCQs06sCYR7vY=; b=lGUO/ciX9noA46apvGTs+YfRa44My/yBYb/iXTJoG8GirS8eTR9ctZfqzZ8FqTIeaX xiGvAKWX0tbwlld4Q7qnZr2U+adpjT6SbfBhDsnPsHrfkvRKbkAh8Sq0wbJ3tl5savB9 z1rzGC3f10HaYhocueQtc5HSv+0bL1iqDy8jDsOUw1Fr12vTvMbe8yGxmPWIIAUrxwFF ZSz7OMJKrft25hPKm37l25Zg/vorvSKD4avA/KLDHFYs+ouWTfsewWB4yBhBORpxs/jx QetDgaOfiamog3nU8lfrESYijynRI2HoP2V58oyg4oa/S+mN7rRvwzCC2eBe5LD2bra1 xmZA== X-Received: by 10.60.121.41 with SMTP id lh9mr567386oeb.20.1365381631669; Sun, 07 Apr 2013 17:40:31 -0700 (PDT) MIME-Version: 1.0 From: Barrett Lewis Date: Sun, 7 Apr 2013 17:40:11 -0700 Subject: with ignored To: Python Mailing List Content-Type: multipart/alternative; boundary=047d7b339bc323793c04d9ceaf66 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 55 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1365381639 news.xs4all.nl 6908 [2001:888:2000:d::a6]:49398 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:43032 --047d7b339bc323793c04d9ceaf66 Content-Type: text/plain; charset=ISO-8859-1 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(): # 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 --047d7b339bc323793c04d9ceaf66 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I was recently watching that Raymond Hettinger video on cr= eating Beautiful Python from this years PyCon.=A0
He mentioned pu= shing up the new idiom

with ignored(&l= t;ignored_exceptions>):
=A0 =A0 =A0# do some work

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

But am unsure how the=A0yield=A0works in the given sit= uation.

I know about creating generato= rs with=A0yield=A0and have read the docs on how it maintains state.

I think it works because it is returning control back = to the caller while=A0maintaining=A0the try so if the caller throws it is c= aught 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=
--047d7b339bc323793c04d9ceaf66--