[Python-Dev] PEP 488: elimination of PYO files
Steven D'Aprano
steve at pearwood.info
Fri Mar 6 23:34:20 CET 2015
On Fri, Mar 06, 2015 at 09:37:05PM +0100, Antoine Pitrou wrote:
> On Fri, 06 Mar 2015 18:11:19 +0000
> Brett Cannon <brett at python.org> wrote:
> > And the dropping of docstrings does have an impact on
> > memory usage when you use Python at scale.
>
> What kind of "scale" are you talking about? Do you have any numbers
> about such impact?
>
> > You're also assuming that we will never develop an AST optimizer
>
> No, the assumption is that we don't have such an optimizer *right now*.
> Having command-line options because they might be useful some day is
> silly.
Quoting the PEP:
This issue is only compounded when people optimize Python
code beyond what the interpreter natively supports, e.g.,
using the astoptimizer project [2]_.
Brett, I'm a very strong +1 on the PEP. It's well-written and gives a
good explanation for why such a thing is needed. The current behaviour
of re-using the same .pyo file for two distinct sets of bytecode is
out-and-out buggy:
[steve at ando ~]$ python3.3 -O -c "import dis; print(dis.__doc__[:32])"
Disassembler of Python byte code
[steve at ando ~]$ python3.3 -OO -c "import dis; print(dis.__doc__[:32])"
Disassembler of Python byte code
The second should fail, since doc strings should be removed under -OO
optimization, but because the .pyo file already exists it doesn't.
Even if CPython drops -O and -OO altogether, this PEP should still be
accepted to allow third party optimizers like astoptimizer to interact
without getting in each other's way.
(And for the record, I'm an equally strong -1 on dropping -O and -OO.)
Thank you.
--
Steve
More information about the Python-Dev
mailing list