Path: csiph.com!usenet.pasdenom.info!news.albasani.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.06; '(b)': 0.07; 'nested': 0.07; 'variables': 0.07; 'function,': 0.09; 'lines.': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '"it\'s': 0.16; 'declaration': 0.16; 'declared': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'globals': 0.16; 'infinitely': 0.16; 'it;': 0.16; 'sure.': 0.16; 'variables,': 0.16; 'weird': 0.16; 'language': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'basically': 0.19; "python's": 0.19; 'programming': 0.22; 'cc:addr:python.org': 0.22; '(a)': 0.24; 'rid': 0.24; 'looks': 0.24; '(or': 0.24; 'cc:2**0': 0.24; 'somewhere': 0.26; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'getting': 0.31; 'easier': 0.31; 'flying': 0.31; 'inspect': 0.31; 'probably': 0.32; 'languages': 0.32; 'another': 0.32; 'programmers': 0.33; 'hundreds': 0.35; 'requirement': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; "he's": 0.36; 'list,': 0.38; 'pm,': 0.38; 'though,': 0.39; 'sure': 0.39; 'mailing': 0.39; 'major': 0.40; 'how': 0.40; 'hope': 0.61; 'name': 0.63; 'kind': 0.63; 'more': 0.64; 'day': 0.76; 'confusion.': 0.84; 'strengths,': 0.84; 'to:none': 0.92; 'mistakes': 0.93 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:cc :content-type; bh=cFKVwoQsLpYT6kRS46Uqt+i+BRFe7581uEPkEAXCC+k=; b=L5AD4lP6e60Gf7QRcs7AmIamoMo0CrgX1RcjwOngg88b6wI5yxo05XjTHbzbxbsFg0 w3vMGdFV3U5BpCXBBSv/MuUAhgw8mSX2N47SGqTczErorMm6GYmw4nP0SRTQCwYXgsDK oQxsiici6pHfYYFOLiMvaCxJq9mZ5cIioReYCMSzcBXGesIpdJmc0mCNg8VU0DmHnfTN 8SPIKCS7EOo/pQ4LtLjxMu2YhLHiv1LET9rHF+LpUJ6Y7WMUOfKUuVqFi8YboagNHwty KqFli12gd6KgWbmFOk+G8J426r+pUnhi5apzD5lD04/NhbCht46ikXTm0ma/VLrOjZKl ybGg== MIME-Version: 1.0 X-Received: by 10.42.38.133 with SMTP id c5mr5611142ice.26.1417581408998; Tue, 02 Dec 2014 20:36:48 -0800 (PST) In-Reply-To: References: Date: Wed, 3 Dec 2014 15:36:48 +1100 Subject: Re: Python handles globals badly. From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1417581411 news.xs4all.nl 2854 [2001:888:2000:d::a6]:52878 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81832 On Wed, Dec 3, 2014 at 3:17 PM, Skybuck Flying wrote: > I hope python one day gets rid of it; > > 1. To stop the confusion. > 2. To stop the doubt. > 3. To stop the wasted lines. > 4. To program with more confidence. > 5. To stop to have to inspect what's going on if one wants to know for sure. > 6. To stop any weird programming mistakes because a global declaration was > not used somewhere in a function, it's probably easier to miss, cause in the > programmers mind he's thinking: "it's global". > > Now it's just some > half-ass-fucked-up-not-really-global-variable-unless-you-specify-it-local-to-be-global-holy-shit-batman-feel-the-brain-pain > ?! > If you want C-like infinitely nested scopes, you basically have to have declared variables, which Python doesn't want. There are other languages which are very Python-like but do have declared variables and infinitely-nested scopes, but I'm not sure I want to deal with this kind of anger on another mailing list, so I won't name one. Once again, though, you need to (a) learn the language before getting irate, and (b) play to its strengths, not its weaknesses. Python's requirement to declare all globals is a major weakness when you have hundreds of globals, so don't do that (or don't complain about how your code looks when you do). ChrisA