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


Groups > comp.lang.python > #12672

Re: Handling 2.7 and 3.0 Versions of Dict

From Terry Reedy <tjreedy@udel.edu>
Subject Re: Handling 2.7 and 3.0 Versions of Dict
Date 2011-09-02 16:22 -0400
References (2 earlier) <mailman.611.1314805519.27778.python-list@python.org> <9c7utuF8q8U1@mid.individual.net> <93c5378e-03f8-4764-96e8-2c3e8568baec@z8g2000yqe.googlegroups.com> <mailman.710.1314981394.27778.python-list@python.org> <42b6b7cb-d659-4921-bec9-6a43671848e2@s20g2000yql.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.719.1314995014.27778.python-list@python.org> (permalink)

Show all headers | View raw


On 9/2/2011 12:53 PM, Travis Parks wrote:
> On Sep 2, 12:36 pm, "Gabriel Genellina"<gagsl-...@yahoo.com.ar>

>> Those if/else are at global scope. An 'if' statement does not introduce a
>> new scope; so getDictValues, despite being "indented", is defined at
>> global scope, and may be used anywhere in the module.

> Does that mean the rules would be different inside a function?

Yes. Inside a function, you would have to add
     global getDictValues
before the if statement in order for the assignments to have global effect.

-- 
Terry Jan Reedy

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


Thread

Handling 2.7 and 3.0 Versions of Dict Travis Parks <jehugaleahsa@gmail.com> - 2011-08-30 18:43 -0700
  Re: Handling 2.7 and 3.0 Versions of Dict Terry Reedy <tjreedy@udel.edu> - 2011-08-30 23:33 -0400
  Re: Handling 2.7 and 3.0 Versions of Dict "Martin v. Loewis" <martin@v.loewis.de> - 2011-08-31 11:55 +0200
    Re: Handling 2.7 and 3.0 Versions of Dict Ian Kelly <ian.g.kelly@gmail.com> - 2011-08-31 09:44 -0600
      Re: Handling 2.7 and 3.0 Versions of Dict Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-09-01 11:37 +1200
        Re: Handling 2.7 and 3.0 Versions of Dict Travis Parks <jehugaleahsa@gmail.com> - 2011-08-31 18:28 -0700
          Re: Handling 2.7 and 3.0 Versions of Dict "Gabriel Genellina" <gagsl-py2@yahoo.com.ar> - 2011-09-02 13:36 -0300
            Re: Handling 2.7 and 3.0 Versions of Dict Travis Parks <jehugaleahsa@gmail.com> - 2011-09-02 09:53 -0700
              Re: Handling 2.7 and 3.0 Versions of Dict Terry Reedy <tjreedy@udel.edu> - 2011-09-02 16:22 -0400
              Re: Handling 2.7 and 3.0 Versions of Dict "Gabriel Genellina" <gagsl-py2@yahoo.com.ar> - 2011-09-02 17:29 -0300

csiph-web