[Python-Dev] LOAD_NAME & classes (original) (raw)
Alex Martelli aleax@aleax.it
Tue, 23 Apr 2002 17:47:30 +0200
- Previous message: [Python-Dev] LOAD_NAME & classes
- Next message: [Python-Dev] LOAD_NAME & classes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tuesday 23 April 2002 05:30 pm, Steve Holden wrote: ...
Might it make more sense to issue a warning at compile time to the effect that a variable is being used before it's assigned? How completely are
Hard to make sure, so, it would always be "MIGHT be used before assignment". E.g.,
def f(): for i in range(6): if i>0: print x, x = str(i)
this is OK... no UnboundNameError. Now, change the if's guard to if SolveTuringHaltingProblem(i): print x, to see why it's hard to make sure about this at compile time.
A warning might still be OK of course, even though it may need to be worded in wishy-washy "might" terms -- this IS peculiar usage.
Alex
- Previous message: [Python-Dev] LOAD_NAME & classes
- Next message: [Python-Dev] LOAD_NAME & classes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]