Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Keen eyes Date: Sun, 17 Jan 2016 19:25:29 +1100 Lines: 18 Message-ID: References: <7625bba2-5c2d-4d28-8b6a-30ec7b490089@googlegroups.com> <569b3e53$0$1615$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de Z3zyaJHmKhYH3/ROKdNEGQQiD0IWu1/XHAYfLGECaVYA== 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; 'received:209.85.223': 0.03; 'defaults': 0.05; 'compile-time': 0.07; 'cc:addr:python- list': 0.09; 'oh,': 0.09; 'jan': 0.11; 'applies': 0.15; 'variables': 0.15; '2016': 0.16; 'allocates': 0.16; 'cc:name:python': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'globals.': 0.16; 'local.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'scope.': 0.16; 'scopes': 0.16; 'wrote:': 0.16; 'variable': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'implicit': 0.22; 'bit': 0.23; 'matching': 0.23; 'header:In-Reply-To:1': 0.24; 'message- id:@mail.gmail.com': 0.27; 'errors.': 0.27; 'var': 0.27; 'far,': 0.29; 'searches': 0.29; 'terminating': 0.29; 'anywhere': 0.30; 'non': 0.32; 'statement': 0.32; 'gets': 0.35; 'received:google.com': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; "won't": 0.38; 'received:209': 0.38; 'within': 0.64; 'you.': 0.64; 'bite': 0.84; 'chrisa': 0.84; 'to:none': 0.91; 'technically': 0.91 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=VV3r9oQRKNL7Ewi2Iw72e95fTHkC2uTYzhcTIQTmOdY=; b=X1NWoNcYOja3RJ4qW5gjMZV6B0D285RM6LzruYXsbFDbellLH3udoDWLy0l92bWReE EQlELLajqByts86MqbCwCnb09AuYA9XsYzU5YECpEfKcrqOctqVf4l7XiNThMHUYd95G UFi7IptbG3+tDogGO1WeVh8MGg6A5pZsqMZ8IbXoFO0r9YDAe8JUFWpMBm+VamT3Cgy3 UXJKY9SSls1w+N7mVP7ezK8toEHHLhnlfj5BctHGAWwnBfrkNreZlYpQ7+OFU4zH3gBX xrOxcZAXnQg7sTHaOxeBaTxJBZRoPPNsURySZgmXbGMH7BDd2qf2q6MMTp+Y2iKF81CJ 2nmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc:content-type; bh=VV3r9oQRKNL7Ewi2Iw72e95fTHkC2uTYzhcTIQTmOdY=; b=f+KlBnmJtBHyXzG31bXuwyiUWxDgv7zR5AF+0Wah0qOFGdfG5yLuxLT/CwuSMu194Q tpMZ/fzSY6sR4MGb4tQr33SZe2aYJ5ZN710ERYeJtzASXoKSn0+Ulx7yP6JCVPdhKZKV I/u51JB1x7PojeDM8mRl44b1X/i/sOX1rROxT8gdrDJPEAJ6uaoyIE8QHwgzoHgNXaeA M7jsAjv+JOzAOTnjFi5phC7RRxNFlAfabMTyG3nC8JxPnwJH30x9I9ZkcodEaKi8Tw94 BFojVxCNXmNrSzTGzA2645pH1uYGUuMcOrluFtHqauNKzA2k+fIvRPG6hykR847c0iha mmKw== X-Gm-Message-State: ALoCoQm2aj1Se2B3+h1eYU+7UCrR91g3vqrLD3AgX+9F8sM47HxPlp1Cpbu3v6XiJS0uipesjF4abkunQ5sOXXnGDkO34PXKRQ== X-Received: by 10.107.47.162 with SMTP id v34mr16017866iov.19.1453019129214; Sun, 17 Jan 2016 00:25:29 -0800 (PST) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:101836 On Sun, Jan 17, 2016 at 6:37 PM, Ian Kelly wrote: > Technically it defaults to non local. The var statement allocates a > variable within the current scope. Otherwise it searches up the chain of > parent scopes for a matching variable... This far, it's exactly the same as C. > ... terminating at the global scope. This is the bit that gets ridiculous. Undeclared variables in C are compile-time errors. Undeclared variables in JS are implicit globals. This is stupid. Oh, plus the fact that you can have "var x;" anywhere but it always applies to the whole function. But most of the time, that won't bite you. ChrisA