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


Groups > comp.lang.python > #101836

Re: Keen eyes

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Keen eyes
Date 2016-01-17 19:25 +1100
Message-ID <mailman.56.1453019131.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> <CALwzid=8RSUQzsicoBac01LXDWs9BUoJ8atnfB4_ag7PmXXC+Q@mail.gmail.com>

Show all headers | View raw


On Sun, Jan 17, 2016 at 6:37 PM, Ian Kelly <ian.g.kelly@gmail.com> 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

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