[Python-Dev] Example for "property" violates "Python is not a one pass compiler"

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Sep 6 13:37:59 CEST 2005


Phillip J. Eby wrote:
> I'm not sure where you got the "Python is not a one pass compiler" idea; I 
> don't recall having seen this meme anywhere before, and I don't see how 
> it's meaningful anyway.

Indeed, Python's bytecode compiler essentially *is*
a one-pass compiler (or at least it used to be -- not
sure what's been done to it recently).

But the behaviour seen here is more about what happens
at run time than compile time. What you're trying to
do is essentially the same as

    print x
    x = 42

which fails at run time because x hasn't been bound
when the print statement is executed.

Greg


More information about the Python-Dev mailing list