Re: Surprised by the lack of constant folding

2017-03-24 Thread duncan smith
On 24/03/17 19:35, Tim Chase wrote: > Playing around, I came across the following > > $ python3 > Python 3.4.2 (default, Oct 8 2014, 10:45:20) > [GCC 4.9.1] on linux > Type "help", "copyright", "credits" or "license" for more information. from dis import dis def f(x): > ... return

Re: Surprised by the lack of constant folding

2017-03-24 Thread Ian Kelly
On Fri, Mar 24, 2017 at 1:35 PM, Tim Chase wrote: > Playing around, I came across the following > > $ python3 > Python 3.4.2 (default, Oct 8 2014, 10:45:20) > [GCC 4.9.1] on linux > Type "help", "copyright", "credits" or "license" for more information. from dis import dis def f(x): > ..

Re: Surprised by the lack of constant folding

2017-03-24 Thread Chris Angelico
On Sat, Mar 25, 2017 at 6:35 AM, Tim Chase wrote: > $ python3 > Python 3.4.2 (default, Oct 8 2014, 10:45:20) > [GCC 4.9.1] on linux > Type "help", "copyright", "credits" or "license" for more information. from dis import dis def f(x): > ... return x * 1024 * 1024 > ... dis(f) >

Surprised by the lack of constant folding

2017-03-24 Thread Tim Chase
Playing around, I came across the following $ python3 Python 3.4.2 (default, Oct 8 2014, 10:45:20) [GCC 4.9.1] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from dis import dis >>> def f(x): ... return x * 1024 * 1024 ... >>> dis(f) 2 0 LOAD