2 + 2 = 5

Hans Mulder hansmu at xs4all.nl
Thu Jul 5 09:57:53 EDT 2012


On 5/07/12 07:32:48, Steven D'Aprano wrote:
> On Wed, 04 Jul 2012 23:38:17 -0400, Terry Reedy wrote:
> 
>> If I run the script in 3.3 Idle, I get the same output you got. If I
>> then enter '5-2' interactively, I still get 3. Maybe the constant folder
>> is always on now.
> 
> Yes, I believe constant folding is always on, since Python 2.4 if I 
> remember correctly. Somebody who cares more than me can possibly check 
> the "What's New" documents :)

It's not a difference between 2.4 and 3.3; the difference is between
Idle and the command-line version of the interactive interpreter.

If I type the same code into Idle and the interactive interpreter
(both using 3.3alpha1), I get 3 in Idle and 2 in Terminal.

I don't quite understand why this difference exists.


Confused,

-- HansM




More information about the Python-list mailing list