Chris Mellon a écrit : > On Dec 11, 2007 8:51 AM, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: >> Chris Mellon a écrit : >> (snip) >>> What's probably happening is that line_ptr < last_line is not true >> Indeed. >> >>> and the body of the function isn't executed at all. The unbound local >>> exception is a runtime error that occurs when the local is accessed, >>> not when the function is compiled. >> Now since the compiler already detected the name as local, why wait >> execution to signal this error ? >> > > Because detection assignment to a name in the first AST scan and then > using LOAD_FAST and STORE_FAST for access to and assigning to that > name is a simple, easy thing to implement, while doing execution > analysis to detect that it can't possibly be set before being > referenced is really hard.
Ok, makes sens. Now nobody should ever rebind a global name anyway !-) -- http://mail.python.org/mailman/listinfo/python-list