R. David Murray added the comment:

Well, the thing is that py_compile *already* has all the needed logic, the flag 
would just allow us to add an if statement before the two lines that write the 
compiled bytecode out to the file system.  py_compile also has the advantage 
that it supports the importlib loader logic.  The goal here (from my point of 
view) is to have a simple command line way of checking the syntax of a script, 
so that last may not be important.  

The python -c using 'compile(open' *is* reasonably brief, but it is not as 
elegant as the 'perl -c' mentioned in the linked stackoverflow question.  
'python -m py_compile' isn't quite a succinct as 'perl -c', but it is a lot 
closer than 

  python -c "compile(open(<filename>).read(), '', 'exec')"

and a lot easier to remember.  Now, you can argue that referencing perl in this 
context is a bit of 'keeping up with the joneses', but I think there is an 
argument to be made that it is worthwhile in this case.  I won't be heartbroken 
if the idea gets shot down, though :)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25303>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to