simple question

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Tue Aug 21 10:10:30 EDT 2001


Thu, 16 Aug 2001 15:30:09 -0700, Jeff Shannon <jeff at ccvcorp.com> pisze:

> However, whenever you assign to a variable name, Python always assumes that
> that name should go into the local scope, unless specifically told
> otherwise.  In the assignment line (NextID = NextID + 1), the right hand
> side is created just as you'd expect, by looking up the (global) NextID and
> adding one to it.

No. Which variables are local is determined statically. When a variable
is assigned to in a function and there is no corresponding global
statement, it's assumed to be local and all uses of this variable
name in this function refer to the local variable.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list