[Python-Dev] one more restriction for from __future__ import ...
Jeremy Hylton
jeremy@alum.mit.edu
Tue, 27 Feb 2001 18:50:30 -0500 (EST)
>>>>> "SM" == Skip Montanaro <skip@mojam.com> writes:
Jeremy> The symbol table pass detects illegal future statements by
Jeremy> comparing the current line number against the line number of
Jeremy> the last legal futre statement.
SM> Why not just add a flag (default false at the start of the
SM> compilation) to the compiling struct that tells you if you've
SM> seen a future-killer statement already? Then if you see a
SM> future statement the compiler can whine.
Almost everything is a future-killer statement, only doc strings and
other future statements are allowed. I would have to add a
st->st_future_killed = 1 for almost every node type.
There are also a number of nodes (about ten) that can contain future
statements or doc strings or future killers. As a result, I'd have to
add special cases for them, too.
Jeremy