This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients brett.cannon, eric.araujo, proski, r.david.murray, terry.reedy
Date 2015-10-09.20:05:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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 :)
Date User Action Args
2015-10-09 20:05:41r.david.murraysetrecipients: + r.david.murray, brett.cannon, terry.reedy, eric.araujo, proski
2015-10-09 20:05:41r.david.murraysetmessageid: <>
2015-10-09 20:05:41r.david.murraylinkissue25303 messages
2015-10-09 20:05:40r.david.murraycreate