free and nonlocal variables

88888 Dihedral dihedral88888 at googlemail.com
Thu Mar 21 10:34:09 CET 2013


bartolom... at 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.




More information about the Python-list mailing list