[Python-3000] Displaying strings containing unicode escapes

Terry Reedy tjreedy at udel.edu
Sat May 3 00:33:15 CEST 2008


"Nick Coghlan" <ncoghlan at gmail.com> wrote in message 
news:481AF228.2080900 at gmail.com...
| Terry Reedy wrote:
| > I think standard Python should somehow have two options: escape 
everything
| > but ASCII (for unambuguity and old display systems) and escape nothing 
that
| > is potentially printable (leaving partially capable systems to fare as 
they
| > will).  In-between solutions will ultimately be programmer and system
| > specific.
|
| If repr() is made to work as Martin suggests (i.e. only escape the
| unprintable stuff), then the unicode_escape codec can be used fairly
| easily to restore the 2.x escape everything non-ASCII behaviour.

so print(s.encode('unicode_escape)) ?
Fine with me, especially if that or whatever is added to the repr() doc. 





More information about the Python-3000 mailing list