[Python-Dev] [comp.lang.python] sys.setdefaultencoding (2.0b1)

Guido van Rossum guido@beopen.com
Fri, 15 Sep 2000 18:31:52 -0500

> I was just reading comp.lang.python and saw an interesting question
> that I couldn't answer.  Is anyone here game?

From reading the source code for unicodeobject.c, _PyUnicode_Init()
sets the default to "ascii" anyway, to the call in site.py is quite
unnecessary.  I think it's a good idea to remove it.  (Look around
though -- there are some "if 0:" blocks that could make it necessary.
Maybe the setdefaultencoding() call should be inside an "if 0:" block
too.  With a comment.

--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)

> Jeremy
> ------- Start of forwarded message -------
> From: Donn Cave <donn@u.washington.edu>
> Newsgroups: comp.lang.python
> Subject: sys.setdefaultencoding (2.0b1)
> Date: 12 Sep 2000 22:11:31 GMT
> Organization: University of Washington
> Message-ID: <8pm9mj$3ie2$1@nntp6.u.washington.edu>
> Mime-Version: 1.0
> Content-Type: text/plain; charset=ISO-8859-1
> I see codecs.c has gone to some trouble to defer character encoding
> setup until it's actually required for something, but it's required
> rather early in the process anyway when site.py calls
> sys.setdefaultencoding("ascii")
> If I strike that line from site.py, startup time goes down by about
> a third.
> Is that too simple a fix?  Does setdefaultencoding("ascii") do something
> important?
> 	Donn Cave, donn@u.washington.edu
> ------- End of forwarded message -------
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@python.org
> http://www.python.org/mailman/listinfo/python-dev