On Thu, 22 Oct 2015 17:02:48 -0000, Brett Cannon <br...@python.org> wrote:
> On Thu, 22 Oct 2015 at 09:37 Stéphane Wirtel <steph...@wirtel.be> wrote:
> 
> > Hi all,
> >
> > When we compile a python script
> >
> > # test.py
> > if 0:
> >         x = 1
> >
> > python -mdis test.py
> >
> > There is no byte code for the condition.
> >
> > So my question is, the byte code generator removes the unused functions,
> > variables etc…, is it right?
> >
> 
> Technically the peepholer removes the dead branch, but since the peepholer
> is run on all bytecode you can't avoid it.

There's an issue (http://bugs.python.org/issue2506) for being able to
disable all optimizations (that Ned Batchelder, among others, would really
like to see happen :).  Raymond rejected it as not being worthwhile.

I still agree with Ned and others that there should, just on principle,
be a way to disable all optimizations.  Most (all?) compilers have such
a feature, for debugging reasons if nothing else.  We even have a way
to spell it in the generated byte code files now (opt-0).  But, someone
would have to champion it and write a patch proposal.

--David
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to