[Python-Dev] forwarded message from Stephen J. Turnbull

Stephen J. Turnbull stephen@xemacs.org
04 Mar 2002 15:18:45 +0900


>>>>> "Neil" == Neil Hodgson <nhodgson@bigpond.net.au> writes:

    Neil>    How does this spill into modules imported from the main
    Neil> script? Will compiled modules need to have a hook marker, so
    Neil> they can be regenerated when called with a different hook
    Neil> function?

I would say no; the hook function is the user's problem.

In PEP 263, of course, the answer would be yes.  Do you automatically
recompile modules just because Python has been upgraded?  If not, PEP
263 has the same issue.  If you do, then everything in the system with
a coding cookie has to get recompiled every time you fix the coding
system support---which will be often[1].

Safety probably requires that a non-Unicode module be recompiled every
time the hook function changes, which implicitly means at least on
every invocation of the python interpreter.  Alternatively, since it's
the non-Unicode encoding that is the weak link (see footnote 1)
anyway, you could just say "not our problem, man, if you want
reliability use a reliable encoding: UTF-8."  This is what I see as
the main advantage of my proposal over PEP 263.

Note that any issues like this that cause trouble in my proposal will
usually map directly into similar problems for PEP 263.  PEP 263 may
actually have more trouble dealing with them since it will be strongly
tempted to have C code doing more than just calling an external Python
module.


Footnotes: 
[1]  Codecs are easy to write correctly if "correctly" is defined by
reference to a well-written published standard such as the Unicode
Standard, ISO 8859, or even ISO 2022.  Trying to make them do the
right thing in the face of massive nonconformance by users and
vendors---eg, I'm told Microsoft apps de facto allow the EURO SIGN in
Windows-125x-encoded documents, although AFAIK the Windows 125x
definition has never been changed to permit this---is what is hard.

-- 
Institute of Policy and Planning Sciences     http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
              Don't ask how you can "do" free software business;
              ask what your business can "do for" free software.