Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'context': 0.07; 'method.': 0.07; 'nested': 0.07; 'variables': 0.07; 'assumed': 0.09; 'instance.': 0.09; 'yeah,': 0.09; 'block.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'other,': 0.16; 'top-level': 0.16; 'wrote:': 0.18; 'separate': 0.22; 'sorry,': 0.24; 'equivalent': 0.26; 'query': 0.26; 'header :In-Reply-To:1': 0.27; 'chris': 0.29; 'related': 0.29; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'piece': 0.31; 'probably': 0.32; 'option': 0.32; "i'd": 0.34; 'transaction': 0.35; 'case,': 0.35; 'received:google.com': 0.35; 'manager': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'ability': 0.39; 'to:addr:python.org': 0.39; 'even': 0.60; 'effectively': 0.66; 'jul': 0.74; 'shadow': 0.84; 'technique.': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=wiBEbMYT7mp+FHhXHtSm1/7TZWIspBEUNuFkKPMotzU=; b=Uov3PH8Gtx/f14kmp652BhtcAC7cXZHI/DJX/rOlpOZB41TaLejtDwbsjZWcz1Ipc5 KMPqQr2BGlK6xKg9i7BIPTot6mj+u66YNS7htiSGmL0Fvp9VAL7/jCTSeaAf99qKp4k8 XRFtU3SMJ0M1yorBfWnuKKt34U9cmxN04l8+Sh8EAm7eyWs/Xv5M9Ql4SgOtdEQgOUTD e8CLb11O9MDthCgHaxV7qmrJ8xzmzIk707JP4cgr37DgzdMT4Vw7Hn+7b6rh4AxYE3Th vdPFkmNx+3hVb3LdhdkwwvjPvfi+6Tw+4h4mA/45HRtbDFD3zU2VkaZeBmjlutPcNxHC Pz3A== MIME-Version: 1.0 X-Received: by 10.52.163.165 with SMTP id yj5mr13139451vdb.104.1373350423330; Mon, 08 Jul 2013 23:13:43 -0700 (PDT) In-Reply-To: References: <51d4eb9c$0$29999$c3e8da3$5496439d@news.astraweb.com> <51d508ed$0$6512$c3e8da3$5496439d@news.astraweb.com> <51d5a504$0$29999$c3e8da3$5496439d@news.astraweb.com> Date: Tue, 9 Jul 2013 16:13:43 +1000 Subject: Re: Default scope of variables From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1373350431 news.xs4all.nl 15881 [2001:888:2000:d::a6]:52054 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:50210 On Tue, Jul 9, 2013 at 4:08 PM, alex23 wrote: > On 9/07/2013 3:07 PM, Chris Angelico wrote: >> >> The subtransactions are NOT concepted as separate transactions. They >> are effectively the database equivalent of a try/except block. > > > Sorry, I assumed each nested query was somehow related to the prior > one. In which case, I'd probably go with Ethan's suggestion of a > top-level transaction context manager with its own substransaction > method. Yeah, that would probably be the best option in this particular instance. Though I do still like the ability to have variables shadow each other, even if there's a way around one particular piece of code that uses the technique. ChrisA