Python switch for syntax checking
poster at news.com
Fri Nov 19 19:46:35 CET 2004
I've been wondering why python itself doesn't provide a switch to
check a file for valid syntax. I know that you can currently call
python -c "import py_compile; py_compile.compile(r'MyApp.py')"
but in order to manage this effectively you have to add a shell alias,
write a script, mess about with your editor, or what have you. This
becomes yet another small annoyance I'd like to get rid of. I'm also
aware of PyChecker and other lint like tools, but these run the code and
often I don't want that.
Being able to do
python -s MyApp.py
and see any syntax errors would be a very useful thing. Is there a
specific reason that this doesn't exist (or perhaps it does and I'm
uninformed)? I don't see any relevant PEPs on the list, either.
More information about the Python-list