On 2013-06-10, dhyams <dhy...@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 -- http://mail.python.org/mailman/listinfo/python-list