PEP 214 - Why not print >> string?
sheershion at mailexpire.com
Thu Jan 10 23:26:25 CET 2002
Daniel Dittmar wrote:
> You could create a subclass of UserString with a write method added.
ISTR there also should be an attribute which the print statment uses to
determine if it should write a space to the output before outputting a
field. I'm too lazy to look for it in the docs, but it's there
somewhere. I have used that it a couple of times to be able to output
text to a window in wxPython using print statements.
But it makes a lot more sense to use a function which does exactly the
same as print and returns a string:
return " ".join([str(x) for x in args])
Much more Pythonic, IMHO.
More information about the Python-list