[Python-3000] Displaying strings containing unicode escapes
Jim Jewett
jimjjewett at gmail.com
Tue Apr 29 21:00:25 CEST 2008
On 4/29/08, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> atsuo ishimoto writes:
>
> > 2008/4/17 Stephen J. Turnbull <stephen at xemacs.org>:
> > > How about choosing a standard Python repertoire (based on the Unicode
> > > standard, of course) of which characters get a graphic repr and which
> > > ones get \u-escaped, and have a post-hook for repr which gets passed
> > > the string repr proposes to print out?
> > Will the standard repertoire exclude Cyrillic or full-with ASCII?
> "Exclude"? Nothing is "excluded". In my proposal, compatibility
> (full-width) "ASCII" will be \u-escaped by repr, yes.
but ...
> [[ You have the way my proposal works backwards. The post-hook
> may be provided by the user ...
I think "standard repertoire based on Unicode" may be confusing the issue.
As I understand it, you're saying something like
For strings, repr will delegate to display_string.
Users can (and should) supply a display_string function
appropriate to their own system.
The default display_string will display ASCII, and unicode-escape
everything else.
Except that you're leaving wiggle room for refinements like:
"OK, we'll display all of Latin-1 by default, because we did in the past"
or
"For security reasons, the control character codes will always be
escaped, instead of passing them to string_display"
-jJ
More information about the Python-3000
mailing list