[Python-Dev] Internationalization Toolkit

Fred L. Drake, Jr. fdrake@acm.org
Thu, 11 Nov 1999 10:02:32 -0500 (EST)


M.-A. Lemburg writes:
 > For explicit handling of Unicode using files, the unicodec module
 > could provide stream wrappers which provide transparent
 > encoding/decoding for any open stream (file-like object):

  Sounds good to me!  I guess I just missed, there's been so much
going on lately.

 > XXX unicodec.file(<filename>,<mode>,<encname>) could be provided as
 >     short-hand for unicodec.file(open(<filename>,<mode>),<encname>) which
 >     also assures that <mode> contains the 'b' character when needed.

  Actually, I'd call it unicodec.open().

I asked:
 >   (Can the -X interpreter option be removed yet?)

You commented:
 > Doesn't Python convert class exceptions to strings when -X is
 > used ? I would guess that many scripts already rely on the class
 > based mechanism (much of my stuff does for sure), so by the time
 > 1.6 is out, I think -X should be considered an option to run
 > pre 1.5 code rather than using it for performance reasons.

  Gosh, I never thought of it as a performance issue!
  What I'd like to do is avoid code like this:

	try:
            class UnicodeError(ValueError):
                # well, something would probably go here...
                pass
        except TypeError:
            class UnicodeError:
                # something slightly different for this one...
                pass

  Trying to use class exceptions can be really tedious, and often I'd
like to pick up the stuff from Exception.


  -Fred

--
Fred L. Drake, Jr.	     <fdrake@acm.org>
Corporation for National Research Initiatives