py_compile vs. built-in compile, with __future__

dhyams dhyams at gmail.com
Mon Jun 10 11:33:59 EDT 2013


The built-in compile() function has a "flags" parameter that one can use to influence the "__future__" mechanism. However, py_compile.compile, which I'm using to byte-compile code, doesn't have an equivalent means to do this.

Is this by design, or would this be considered a bug?  I'm just wanting to do something like:

import __future__
py_compile.compile("foobar.py",flags=__future__.CO_FUTURE_DIVISION)

but there is no "flags" parameter to py_compile.compile().

It seems like this would be fixed just as easily as adding a "flags" parameter to py_compile.compile(), and then passing that through to the built-in compile(), which is called inside of py_compile.compile().



More information about the Python-list mailing list