please help explain this result

Gregory Ewing greg.ewing at canterbury.ac.nz
Sun Oct 17 17:28:03 EDT 2010


Yingjie Lan wrote:

> So, I assume that when the 'def' is executed, any 
> name occurred will be categorized as either local 
> or global (maybe nonlocal?).

Actually it happens earlier than that -- the bytecode
compiler does the categorization, and generates different
bytecodes for accessing these three kinds of name.

-- 
Greg



More information about the Python-list mailing list