Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #101834

Re: Keen eyes

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Ian Kelly <ian.g.kelly@gmail.com>
Newsgroups comp.lang.python
Subject Re: Keen eyes
Date Sun, 17 Jan 2016 00:37:00 -0700
Lines 21
Message-ID <mailman.55.1453016223.15297.python-list@python.org> (permalink)
References <d8e5eaf4-c59f-4635-8e73-f4a9a1a84877@googlegroups.com> <mailman.47.1452983435.15297.python-list@python.org> <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 m3Re38kfl9WPJrx2V4UAVgCGusSlRjtqx7/8XQYNefmQ==
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.014
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'received:209.85.223': 0.03; 'defaults': 0.05; 'variable,': 0.07; 'jan': 0.11; 'variables': 0.15; '2016': 0.16; 'allocates': 0.16; 'local.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'scope.': 0.16; 'scopes': 0.16; 'wrote:': 0.16; '&gt;': 0.18; 'variable': 0.18; 'variables.': 0.22; 'am,': 0.23; 'matching': 0.23; 'header :In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'var': 0.27; 'function': 0.28; 'searches': 0.29; 'terminating': 0.29; 'somebody': 0.30; 'another': 0.32; 'non': 0.32; 'possibly': 0.32; 'statement': 0.32; 'received:google.com': 0.35; 'should': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'skip:& 10': 0.37; 'received:209': 0.38; 'to:addr:python.org': 0.40; 'called': 0.40; 'email addr:gmail.com': 0.62; 'different': 0.63; 'within': 0.64; 'believe': 0.66; 'sounds': 0.76; '"j"': 0.84; 'terrible': 0.84; 'to:name:python': 0.84; '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:to :content-type; bh=28hj00t8mLG1HJVU8a89MmFgpdiL+euj/DILrMvKENY=; b=IzVtSBbXaNwtvBNhVQ+VsYQGxnpXID/Gqs46na8MDkSGWrF/PB7Wc/J1nLZ7JqxEbS 6dju0PBZ+xMfjBgPTRspJmzjHCdhXV4OD3haKEJb1SVdF/5gkBD3dF5ip1nU16cEodE6 zaREbaBigdD+qDXYxsl/hLCHx4EbujNP9widKFCHY3XEMfKmQtmst5nSHqbmgNqBlYb1 z9/GUj2LqdMZP1nKnPbzefhi9CHnj66xEmfdeEwHvF0B+RZCZIPlp3yFcHL3uzkfFLXH Gbe3XG4LxvRIiDtyPbKz9VsmZnbE6wCx1+vlX/y8nlVMbMpGfo/8RsOcsiyTZ0DX0sYe 4buQ==
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:to:content-type; bh=28hj00t8mLG1HJVU8a89MmFgpdiL+euj/DILrMvKENY=; b=bEfOWgz5xrK/d8/6ktarn3B7RtpJHM4iDiY0gc+Ygt5Z6iUpjlpp5SlCg8Ngv9RqqM T5IFI/ottjiEbwsYhEnhZRKT82HDQuycl38wx3DCliWQtbAsCKienIZxIUJjIEQj4gPy 16FqPQw2Yh+GgwUjxZMEpLOaDGHi85sTRnICEkQZ5aRtJwMoqfCnuEvmh8xiCUneB3DR J/AgjLEuxjFQo5a4y/AaiRq5hJRsw0PnsdKHeK+aDjU2flLdm3chLH5Bo9ZzeCeLjuZG XVbv8BfFauuqKYKG+QjRXLDHcrMHPhtKls6sY6T2SIuklM+veBl3G0Y5Y/iACgoRpO0d TQ+Q==
X-Gm-Message-State ALoCoQm42m03JtQYcimkxzoriRQUeTbLAqNw5nSdt1Iu90uyJUi5XayB9PrzLve2HUmH3TebMRV7nKxoRLGmIlmYBj490zRAvA==
X-Received by 10.107.11.68 with SMTP id v65mr16780140ioi.188.1453016220828; Sat, 16 Jan 2016 23:37:00 -0800 (PST)
In-Reply-To <569b3e53$0$1615$c3e8da3$5496439d@news.astraweb.com>
X-Content-Filtered-By Mailman/MimeDel 2.1.20+
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:101834

Show key headers only | View raw


On Jan 17, 2016 12:16 AM, "Steven D'Aprano" <steve@pearwood.info> wrote:
>
> On Sun, 17 Jan 2016 10:25 am, jonas.thornvall@gmail.com wrote:
>
> > double use of j in two different functions
>
> Are you using a global variable called "j" as a loop variable? That sounds
> like a terrible idea.
>
> You should use local variables. Then a function with a local variable j
> cannot possibly effect another function with a local variable also called
> j.
>
> Wait... is somebody going to tell me that Javascript defaults to global
> variables inside functions?

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, terminating at the global scope.

I believe Lua also works this way.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Keen eyes jonas.thornvall@gmail.com - 2016-01-16 14:23 -0800
  Re: Keen eyes Chris Angelico <rosuav@gmail.com> - 2016-01-17 09:30 +1100
    Re: Keen eyes jonas.thornvall@gmail.com - 2016-01-16 14:55 -0800
    Re: Keen eyes jonas.thornvall@gmail.com - 2016-01-16 15:25 -0800
      Re: Keen eyes Steven D'Aprano <steve@pearwood.info> - 2016-01-17 18:10 +1100
        Re: Keen eyes Ian Kelly <ian.g.kelly@gmail.com> - 2016-01-17 00:37 -0700
        Re: Keen eyes Paul Rubin <no.email@nospam.invalid> - 2016-01-16 23:52 -0800
        Re: Keen eyes Chris Angelico <rosuav@gmail.com> - 2016-01-17 19:25 +1100
          Re: Keen eyes BartC <bc@freeuk.com> - 2016-01-17 11:17 +0000
            Re: Keen eyes Chris Angelico <rosuav@gmail.com> - 2016-01-17 22:32 +1100

csiph-web