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


Groups > comp.lang.python > #41640

Re: free and nonlocal variables

Newsgroups comp.lang.python
Date 2013-03-21 02:34 -0700
References <263e910f-4cc5-4b50-bf8d-c207622170b5@googlegroups.com>
Message-ID <7f0df9d6-6370-478a-85fb-6e6f2ed869c5@googlegroups.com> (permalink)
Subject Re: free and nonlocal variables
From 88888 Dihedral <dihedral88888@googlemail.com>

Show all headers | View raw


bartolom...@gmail.com於 2013年3月21日星期四UTC+8下午4時52分17秒寫道:
> In Python 3, "free variable" and "nonlocal variable" are synonym terms? Or is there a difference, like "a free variable is a variable that is not a local variable, then nonlocal variables and global variables are both free variables"?
> 
> 
> 
> Thanking you in advance,
> 
> Bartolomé Sintes

In python the interpreter has to check 4 levels of dictionaries
in the run time to perform an action. The for levels are:
1. object instance level 
2. class level
3. local function level
4. global level.

Objects created at level 1,2,3 can be returned to some other 
object in the run time.

Thus a GC is available to save the  trouble of tracking 
everything for the programmer in a complex system.

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


Thread

free and nonlocal variables bartolome.sintes@gmail.com - 2013-03-21 01:52 -0700
  Re: free and nonlocal variables 88888 Dihedral <dihedral88888@googlemail.com> - 2013-03-21 02:34 -0700
  Re: free and nonlocal variables Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-21 11:00 +0000
  Re: free and nonlocal variables Terry Reedy <tjreedy@udel.edu> - 2013-03-21 07:55 -0400
  Re: free and nonlocal variables Nobody <nobody@nowhere.com> - 2013-03-21 19:05 +0000
    Re: free and nonlocal variables Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-03-21 22:36 +0200

csiph-web