[Python-Dev] #pragmas in Python source code

Paul Prescod paul@prescod.net
Tue, 18 Apr 2000 09:42:32 -0500


My vote is all or nothing. Either the whole file is in UCS-2 (for
example) or none of it is. I'm not sure if we really need to allow
multiple file encodings in version 1.6 but we do need to allow that
ultimately.

If we agree to allow the whole file to be in another encoding then we
should use the XML trick of having a known start-sequence for encodings
other than UTF-8. It doesn't matter much whether it is syntactically a
comment or a pragma. I am still in favor of compile time pragmas but
they can probably wait for Python 1.7.

> Using this technique which was introduced by Fredrik Lundh
> we could in fact have Python scripts which are encoded in
> UTF-16 (two bytes per character) or other more obscure
> encodings. The Python interpreter would only see Unicode
> and Latin-1.

In what sense is Latin-1 not Unicode? Isn't it just the first 256
characters of Unicode or something like that?

-- 
 Paul Prescod  - ISOGEN Consulting Engineer speaking for himself
[In retrospect] the story of a Cold War that was the scene of history's
only nuclear arms race will be very different from the story of a Cold
War that turned out to be only the first of many interlocking nuclear
arms races in many parts of the world. The nuclear, question, in sum,
hangs like a giant question mark over our waning century.
	- The Unfinished Twentieth Century by Jonathan Schell
	  Harper's Magazine, January 2000