Bill McClain wrote: > On 2008-12-09, Peter Otten <[EMAIL PROTECTED]> wrote: > >> >>> out = io.StringIO() >> >>> print(u"hello", file=out, end=u"\n") >> >>> out.getvalue() >> u'hello\n' > > That has the benefit of working. Thank you! > > That can't be the intended behavior of print(), can it? Insering > non-unicode spaces and line terminators? I thought all text was unicode > now. Or is that only in 3.0?
Yes it's 3.0 only. I have no clear idea of the implications of using the print() function in 2.6 yet; maybe changing the defaults for end/sep to unicode would suffice to make it work smoothly. I will probably defer the transition from statement to function until I move to 3.x. One benefit of the function is that you can do things like from functools import partial print = partial(print, sep=u" ", end=u"\n") Peter -- http://mail.python.org/mailman/listinfo/python-list