Message81761
> 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? |
|
Date |
User |
Action |
Args |
2009-02-12 13:22:33 | vstinner | set | recipients:
+ vstinner, lemburg, loewis, facundobatista, ajaksu2, hthompson |
2009-02-12 13:22:32 | vstinner | link | issue637094 messages |
2009-02-12 13:22:32 | vstinner | create | |
|