feature suggestion
Scott David Daniels
Scott.Daniels at Acm.Org
Fri Dec 24 08:37:22 EST 2004
flexibal wrote:
> hi there.
>
> i didnt know if i should post it at python-dev or here, so i'll start
> here.
Good choice. Python-dev is not a location for you to propose work for
other people to do for you.
> BASIC has the "OPTION EXPLICIT" feature that forces you to explicitly
> declare all variables, and i see no reason why python should have a
> similar mechanism.
What you are looking for is "pychecker" -- use google and find that;
you will be able to find many of the code problems you talk about
here.
> syntactic verification, at parsing time. for example:
> my-prog.py:
> -------------
> ##decl x
> ##decl y, z
> x = 5
> y = 6
> z = 8
> a = 6 ### causes and error
This is _not_ a syntax error, syntax can be checked locally, without
memory. "a = 6" is not a syntax error because you can tell exactly
valid what form the statement has, and the form of every expression
in the statement. "a = 6 5" _is_ a syntax error; there is no way to
interpret "6 6" as an expression, and there is no way to interpret
"<statement> 6" as a statement. So, even if your proposal were to
be implemented, it would probably be an "access to undeclared
identifier" error.
--Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list