Path: csiph.com!usenet.pasdenom.info!news.albasani.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.080 X-Spam-Evidence: '*H*': 0.84; '*S*': 0.00; 'responding': 0.07; 'question?': 0.09; 'spelled': 0.09; 'language,': 0.12; 'another?': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'nightmare': 0.16; 'wrote:': 0.18; 'normally': 0.19; "python's": 0.19; 'saying': 0.22; 'mon,': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'lines': 0.31; 'that.': 0.31; '(maybe': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'file': 0.32; 'probably': 0.32; 'something': 0.35; 'no,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'yours,': 0.36; 'should': 0.36; 'two': 0.37; 'same.': 0.38; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'different': 0.65; 'design.': 0.68; 'therefore': 0.72; 'jul': 0.74; 'obvious': 0.74; 'goal': 0.75; 'introduce': 0.78; '"one': 0.84; '3:00': 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=rHxHKGxzzJ11Odvibe3ZTNDnUjtZDFIBlug42C2TXcY=; b=AinWtgpSvQqnCnjvOnZdKJv+KcFrmKVlgYNyBhVEn8gQVVMvpc2Z+syFbxQDKhaQGW bf/ryc5DYtvsVupXNVg4Vfy6KtQRCbMMZlkg7WZ7mGchANEM9bUhNzJdbIimczuQPQUL yAIq9OhP68yp0U/0bVK824Z95JZbhApekZPIIwH7cBdGeKlUsAx7b8uLBmcxvHbMw3md I97jonOXaFEbkjjmWRQBfME/G/aFjO0I7VL2HRcQlFlx6ZfJmRNzwXvJSvUXDroPppEB ZhnR8ZpiQDs1ldqsK8a2supBuYwexeZP9GRJyM0V65zxR77ahkmZeR2+oT0xKwxC/JSF FQMQ== MIME-Version: 1.0 X-Received: by 10.52.120.77 with SMTP id la13mr10857286vdb.23.1373260446321; Sun, 07 Jul 2013 22:14:06 -0700 (PDT) In-Reply-To: <51da4780$0$6512$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> <51D99CBC.40606@stoneleaf.us> <51da2294$0$6512$c3e8da3$5496439d@news.astraweb.com> <51da4780$0$6512$c3e8da3$5496439d@news.astraweb.com> Date: Mon, 8 Jul 2013 15:14:06 +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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1373260454 news.xs4all.nl 15967 [2001:888:2000:d::a6]:38720 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:50117 On Mon, Jul 8, 2013 at 3:00 PM, Steven D'Aprano wrote: > On Mon, 08 Jul 2013 13:11:37 +1000, Chris Angelico wrote: >> It's not something to be solved by the language, but it's often >> something to be solved by the program's design. Two lines of code that >> achieve the same goal should normally look the same. This is why >> Python's policy is "one obvious way to do something" rather than "spell >> it five different ways in the same file to make a nightmare for other >> people coming after you". Why should database queries be spelled >> "trans1.query()" in one place, and "trans2.query()" in another? > > Is that a trick question? They probably shouldn't. But it's a big leap > from that to "...and therefore `for` and `while` should introduce their > own scope". No, it's not a trick question; I was responding to Ethan's suggestion as well as yours, and he was saying pretty much that. BruceA (maybe that'll reduce the confusion?)