Dumb newbie back in shell

Chris Mellon arkanes at gmail.com
Tue Dec 11 10:25:29 EST 2007


On Dec 11, 2007 8:51 AM, Bruno Desthuilliers
<bruno.42.desthuilliers at wtf.websiteburo.oops.com> 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.



More information about the Python-list mailing list