[Python-3000] Displaying strings containing unicode escapes
Nick Coghlan
ncoghlan at gmail.com
Sat May 3 20:00:05 CEST 2008
Stephen J. Turnbull wrote:
> Nick Coghlan writes:
> > Martin v. Löwis wrote:
> > >> Is new built-in function desirable, or just document is good enough?
> > >
> > > Traditionally, I take the position that new built-in functions are
> > > rarely desirable; this one is no exception.
> >
> > I agree with that, but string.repr_ascii may be a reasonable thing to add.
>
> But this is basically completely a codec issue. We have an internal
> representation, and we want to translate it in a stream-oriented way
> to an external representation. Unless there's an efficiency issue,
> why not just provide a hook for a codec?
It would just be a convenience function to do a string to string
conversion in code. I agree for an actual output stream you could just
set the encoding to ASCII with backslashreplace error handling.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-3000
mailing list