This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients ajaksu2, facundobatista, hthompson, lemburg, loewis, vstinner
Date 2009-02-12.13:22:31
SpamBayes Score 5.905914e-07
Marked as misclassified No
Message-id <200902121422.25671.victor.stinner@haypocalc.com>
In-reply-to <499416D0.3060006@egenix.com>
Content
> 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?
History
Date User Action Args
2009-02-12 13:22:33vstinnersetrecipients: + vstinner, lemburg, loewis, facundobatista, ajaksu2, hthompson
2009-02-12 13:22:32vstinnerlinkissue637094 messages
2009-02-12 13:22:32vstinnercreate