Re: Interactive entered code, inserts spurious numbers.

2015-07-31 Thread Steven D'Aprano
On Fri, 31 Jul 2015 06:47 pm, Antoon Pardon wrote: > That is different behaviour from python2, which gives me > the expected result. My guess is that the write returns > 11, being the number of characters written en that the > interpreter, shows that each time through the loop. In Python 3, write

Re: Interactive entered code, inserts spurious numbers.

2015-07-31 Thread Chris Angelico
On Fri, Jul 31, 2015 at 6:47 PM, Antoon Pardon wrote: > That is different behaviour from python2, which gives me > the expected result. My guess is that the write returns > 11, being the number of characters written en that the > interpreter, shows that each time through the loop. > > But is this

Interactive entered code, inserts spurious numbers.

2015-07-31 Thread Antoon Pardon
I'm using python 3.4.2 on debian 8. This is the code: 8< = import sys write = sys.stdout.write from math import pi frac = 3 for a in range(2 * frac): write("%2d: %6.4f\n" % (a, a * pi / frac)) = 8< Now when this code is written in a file and executed I get the expected