Hi,

Dag Sverre Seljebotn wrote:
> There's a problem if you do an empty print (newline
> print) right after a non-newline print. The attached test case works in
> Py2 but fails in Py3 (the line with "2 2 2" is output as "2 2 2 " instead).

> for i in range(3):
>        print 2,
> print

Right, that makes sense. The Py3 print() function (that we map the print
statement to when running under Py3) has an explicit 'end' keyword that keeps
it from having to do any "softspace" special casing. So this is a difference
that is hard to emulate in Py3, which (as opposed to Py2) does not expose the
softspace hint at all.

http://www.python.org/dev/peps/pep-3105/

Open poll:

a) would it be acceptable if this difference persisted, i.e. if Cython code
   that uses something like the example above would behave different in Py3
b) should Cython try to special case this in Py3 to emulate the Py2 behaviour
   in common cases
c) should Cython stick to the Py3 behaviour also in Py2 (thus breaking the
   complete semantics of the print statement)

?

(I am not asking here if we should support the print() function in Cython
source code, which we may do anyway some day. But that's orthogonal.)

Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to