Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'django.': 0.05; 'exception,': 0.07; 'posting.': 0.07; 'reply- to:addr:comp.lang.python': 0.09; 'sake': 0.09; 'storing': 0.09; 'to:addr:comp.lang.python': 0.09; 'exception;': 0.16; 'hmmm,': 0.16; 'subject:variable': 0.16; 'cc:addr:python-list': 0.16; 'cc:no real name:2**0': 0.20; 'subject:list': 0.21; 'header:In- Reply-To:1': 0.22; 'along.': 0.23; 'cc:2**0': 0.24; 'code': 0.25; "i'm": 0.26; 'variable': 0.28; 'bit': 0.28; 'cc:addr:python.org': 0.29; 'subject:?': 0.31; 'header:User-Agent:1': 0.33; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'received:209': 0.40; 'within': 0.60; 'more': 0.61; 'header:Reply- To:1': 0.71; 'reply-to:no real name:2**0': 0.72; 'reply- to:addr:googlegroups.com': 0.74 Newsgroups: comp.lang.python Date: Mon, 5 Dec 2011 11:15:04 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.114.87.114; posting-account=dAOV_goAAABEUkqpkMcBZ68KkIzfCnsO References: <25531460.861.1323104692320.JavaMail.geo-discussion-forums@yqiv14> User-Agent: G2/1.0 X-Google-Web-Client: true MIME-Version: 1.0 Subject: Re: Scope of variable inside list comprehensions? From: Roy Smith To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: comp.lang.python@googlegroups.com List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 3 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1323112508 news.xs4all.nl 6970 [2001:888:2000:d::a6]:44759 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:16680 Hmmm, the use of id was just a simplification for the sake of posting. The real code is a bit more complicated and used a different variable name, but that's a good point. As far as storing the value in the exception, unfortunately, DoesNotExist is not my exception; it comes from deep within django. I'm just passing it along.