Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #34288 > unrolled thread

why does dead code costs time?

Started byBruno Dupuis <python.ml.bruno.dupuis@lisael.org>
First post2012-12-05 16:46 +0100
Last post2012-12-05 22:58 +0100
Articles 2 on this page of 22 — 12 participants

Back to article view | Back to comp.lang.python


Contents

  why does dead code costs time? Bruno Dupuis <python.ml.bruno.dupuis@lisael.org> - 2012-12-05 16:46 +0100
    Re: why does dead code costs time? Neil Cerutti <neilc@norwich.edu> - 2012-12-05 16:15 +0000
      Re: why does dead code costs time? Bruno Dupuis <python.ml.bruno.dupuis@lisael.org> - 2012-12-05 17:40 +0100
        Re: why does dead code costs time? Ramchandra Apte <maniandram01@gmail.com> - 2012-12-09 06:11 -0800
          Re: why does dead code costs time? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-12-09 16:47 +0000
            Re: why does dead code costs time? Ramchandra Apte <maniandram01@gmail.com> - 2012-12-12 21:23 -0800
              Re: why does dead code costs time? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-13 06:01 +0000
                Re: why does dead code costs time? rusi <rustompmody@gmail.com> - 2012-12-12 22:27 -0800
                  Re: why does dead code costs time? Cameron Simpson <cs@zip.com.au> - 2012-12-13 17:51 +1100
                    Re: why does dead code costs time? rusi <rustompmody@gmail.com> - 2012-12-12 22:59 -0800
                      Re: why does dead code costs time? Chris Angelico <rosuav@gmail.com> - 2012-12-13 18:03 +1100
            Re: why does dead code costs time? Ramchandra Apte <maniandram01@gmail.com> - 2012-12-12 21:23 -0800
      Re: why does dead code costs time? Bruno Dupuis <python.ml.bruno.dupuis@lisael.org> - 2012-12-05 18:19 +0100
        Re: why does dead code costs time? Tim Roberts <timr@probo.com> - 2012-12-05 21:20 -0800
    Re: why does dead code costs time? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-05 17:34 +0000
      Re: why does dead code costs time? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-05 17:39 +0000
      Re: why does dead code costs time? Ian Kelly <ian.g.kelly@gmail.com> - 2012-12-05 10:59 -0700
      Re: why does dead code costs time? Bruno Dupuis <python.ml.bruno.dupuis@lisael.org> - 2012-12-05 19:24 +0100
      Re: why does dead code costs time? Terry Reedy <tjreedy@udel.edu> - 2012-12-05 15:41 -0500
      Re: why does dead code costs time? Chris Kaynor <ckaynor@zindagigames.com> - 2012-12-05 12:49 -0800
      Re: why does dead code costs time? Bruno Dupuis <python.ml.bruno.dupuis@lisael.org> - 2012-12-05 21:50 +0100
      Re: why does dead code costs time? Bruno Dupuis <python.ml.bruno.dupuis@lisael.org> - 2012-12-05 22:58 +0100

Page 2 of 2 — ← Prev page 1 [2]


#34324

FromBruno Dupuis <python.ml.bruno.dupuis@lisael.org>
Date2012-12-05 21:50 +0100
Message-ID<mailman.524.1354740657.29569.python-list@python.org>
In reply to#34297
On Wed, Dec 05, 2012 at 03:41:19PM -0500, Terry Reedy wrote:
> On 12/5/2012 1:24 PM, Bruno Dupuis wrote:
> >On Wed, Dec 05, 2012 at 10:59:26AM -0700, Ian Kelly wrote:
> >>On Wed, Dec 5, 2012 at 10:34 AM, Steven D'Aprano
> >><steve+comp.lang.python@pearwood.info> wrote:
> >>>The difference is almost certain between the LOAD_CONST and the
> >>>LOAD_GLOBAL.
> >>>
> >>>As to *why* there is such a difference, I believe that's a leftover from
> >>>early Python days when None was not a keyword and could be reassigned.
> >>
> >>I think this should even be considered a bug, not just a missing
> >>optimization.  Consider:
> >
> >This is definitely a bug
> >
> >>>>>globals()['None'] = 42
> >>>>>def f(x):
> >>...     return None
> >>...     print(x)
> >>...
> >>>>>f('test')
> >>42
> >
> >This one is pretty scary
> >
> >The difference between `return None` and `return` leads to inconsistency and
> >is in contradiction with the specs, AFAIK. I'm glad we pointed this out.
> 
> You did not specify version, but I confirmed in 3.3.0. Please open a
> tracker issue.

It is also in 2.7 and 3.4 head, I didn't test other versions. I forgot
to mention here the issue I have just opened:
http://bugs.python.org/issue16619

-- 
Bruno Dupuis

[toc] | [prev] | [next] | [standalone]


#34331

FromBruno Dupuis <python.ml.bruno.dupuis@lisael.org>
Date2012-12-05 22:58 +0100
Message-ID<mailman.528.1354744703.29569.python-list@python.org>
In reply to#34297
I added a patch on the issue tracker. It solves the bug for short
(<32700 bytes) functions

ref : http://bugs.python.org/file28217/16619-1.patch

-- 
Bruno Dupuis

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.python


csiph-web