Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed1.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.043 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'nested': 0.07; 'emulate': 0.09; 'arbitrarily.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'levels,': 0.16; 'ought': 0.16; 'wrote:': 0.18; 'mon,': 0.24; 'equivalent': 0.26; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'primarily': 0.30; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'block,': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'probably': 0.32; 'received:google.com': 0.35; 'two': 0.37; 'represent': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'more': 0.64; 'jul': 0.74; 're-design': 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=xxD5ZvfDdAUxNnGIlTVVQBDz2jLnZ4YXe68hsEe6sxQ=; b=vUD1zEDu9dem12YDblNPqOwzaQA6uMydwsobHOb2F4VgTZJWl83HSBr5OnRmojf6Sf Mqh/aUQNi5CwBbMYBBJxX+h3po7+znualvg3xoHHST4LX1RqapHcPoRVkwDNaxNeT3jg b9xHbilPy1OznIBkDtlIDg9ONudhdeajTxCtQbBRmYMPk1dewBTa+oTzI6f0tsPo4fJp wBmlkPkT7TIwWBzrKqbN7i4QKLQdbkXAThylSrTGBwq8zYPNZDUff/nis1p6A0+O3TTZ Ro222o5J4Jxfh8Dm9OaXpqE0k2Roi89ltEA1rXobP+U7zWjyGew/XlGZkeNVrGWvbsBG eBvQ== MIME-Version: 1.0 X-Received: by 10.220.48.17 with SMTP id p17mr12248776vcf.97.1373244419648; Sun, 07 Jul 2013 17:46:59 -0700 (PDT) In-Reply-To: <51d99167$0$9505$c3e8da3$5496439d@news.astraweb.com> 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> <51d99167$0$9505$c3e8da3$5496439d@news.astraweb.com> Date: Mon, 8 Jul 2013 10:46:59 +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: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1373244429 news.xs4all.nl 15889 [2001:888:2000:d::a6]:36704 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:50111 On Mon, Jul 8, 2013 at 2:03 AM, Steven D'Aprano wrote: > If you need more than two levels, you probably ought to re-design your > code to be less confusing, otherwise you may be able to use ChainMap to > emulate any number of nested scopes. The subtransactions are primarily to represent the database equivalent of a try/except block, so they need to be able to be nested arbitrarily. ChrisA