18 Aug 22:07
[Cython] print statement under Py3k
From: Stefan Behnel <stefan_ml@...>
Subject: [Cython] print statement under Py3k
Newsgroups: gmane.comp.python.cython.devel
Date: 2008-08-18 20:07:43 GMT
Subject: [Cython] print statement under Py3k
Newsgroups: gmane.comp.python.cython.devel
Date: 2008-08-18 20:07:43 GMT
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) ?(Continue reading)
But I think
this is the optimal option.
RSS Feed