[Distutils] Re: [I18n-sig] Codecs for Big Five and GB 2312
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Sat Oct 28 16:33:01 2000
> Having to import the package has two benefits:
> 1. the need for another codec package is visible in the source code
I don't think this is a benefit for a typical application that uses
multiple codecs. More often than not, the application will learn about
a required encoding by means of an application-level protocol (e.g. a
Content-Type in a MIME header). It doesn't really *require* any
encoding; instead, it needs the codecs of any data it happens to
process in a certain session. The application designer is normally not
interested in a specific encoding; she expects Python to do the right
thing whenever .encode is invoked.
> 2. registering the search function is delayed until the codec
> package is first used
That is hardly a benefit: registering the search function is not an
expensive operation, and the typical application would start with
try:
import japanese
except ImportError:
pass
try:
import windows_codepages
except ImportError:
pass
try:
import iana
except ImportError:
pass
try:
import OSFCharmaps
except ImportError:
pass
anyway, so all codecs it may need are registered right from the start.
Regards,
Martin