On Sun, Oct 2, 2011 at 4:16 AM, Stephen J. Turnbull
surely the FUNC above ...
> """DOC""" > nonlocal NAME > BODY > return FUNC
... doesn't need to be the *same identifier* as the FUNC below?
> FUNC = <anon1>()
Isn't magic needed solely to inject the nonlocal statement(s) into the definition of FUNC inside <anon1> at compile-time?
Well, having 'FUNC' the same from the compiler's point of view is also necessary to get introspection to work properly (i.e. FUNC.__name__ == 'FUNC'). But yeah, the fundamental challenge lies in telling the compiler to change the way it binds and references certain names (like global and nonlocal declarations) while also being able to initialise them at function definition time (like default arguments). Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia