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 -- http://mail.python.org/mailman/listinfo/python-list