[Python-Dev] LOAD_NAME & classes (original) (raw)

Michael Hudson mwh@python.net
24 Apr 2002 12:13:12 +0100


Tim Peters <tim.one@comcast.net> writes:

[Michael Hudson, on UnboundLocalErrors] > ... > Wouldn't it be nice if these were flagged at compile time! More work > for Jeremy .

As will (or already has ) been pointed out, the compiler can only guess, and can't always guess right (it could err on the side of bothering you without cause, though).

That's what I was implying, yes.

PyChecker goes a long way already. Java has a mass of "definite assignment" rules instead, which in effect decree that you must write code in such a way that the compiler can always guess right.

Are these explained in an easy to digest form somewhere?

Cheers, M.

-- I saw `cout' being shifted "Hello world" times to the left and stopped right there. -- Steve Gonedes