py_compile vs. built-in compile, with __future__
Neil Cerutti
neilc at norwich.edu
Tue Jun 11 11:37:17 EDT 2013
On 2013-06-10, dhyams <dhyams at gmail.com> wrote:
> On Monday, June 10, 2013 6:36:04 PM UTC-4, Chris Angelico wrote:
>> Can you read the file into a string, prepend a future directive, and
>>
>> then compile the string?
>
> Technically yes, except that now there is complication of
> writing the modified module back to a file so that I can still
> use py_compile.compile() to byte compile that code.
You would use StringIO instead of writing a temp file.
--
Neil Cerutti
More information about the Python-list
mailing list