STINNER Victor <victor.stin...@haypocalc.com> added the comment: > Python3 fixes the "print" statement to be a function, which allows > much better extensibility of the concept. > > You can have the same in Python2 with a little effort: just create > your own myprint() function and have it process Unicode in whatever > way you want.
About myprint(): sure, it's possible to write a custom issue. But the feature request was to use obj.__unicode__() instead of obj.__str__() for an "unicode aware stream". The problem with Python2 is that there is not clear separation between "bytes stream" ("raw stream"?) and "unicode aware stream" (like io.open or codecs.open). I think that fixing this issue (#637094) was one of the goal of the new I/O library (io in Python3). Using __unicode__() for some object and __str__() for some other sounds strange/dangerous to me. I prefer bytes-only stream or unicode-only stream, but not bytes-and-sometimes-unicode stream. Python2 has only bytes stream. Python3 has both: open(name, 'rb') is bytes only, and open(name, 'r') is unicode only. lemburg> Does your message mean that you want to reopen the issue? _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue637094> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com