Python's 8-bit cleanness deprecated?

Anders J. Munch andersjm at dancontrol.dk
Wed Feb 5 13:22:11 CET 2003


"Andrew Bennetts" <andrew-pythonlist at puzzling.org> wrote:
>
> I agree in principle, but I just realised a possibly strong argument in
favour
> of putting the encoding in a comment: with your proposal, how would you
> write a unicode source file that worked in both Python 2.3 and older Pythons
> (e.g. 1.5.2)?
>
> Then again, it perhaps isn't even possible to write a unicode source file
> that works for 1.5.2 no matter what you do (unless you stick to e.g. plain
> ASCII, which is technically also correct UTF-8), so perhaps this isn't a
> real problem.  I don't know enough about unicode to know.

Exactly, quoting from the PEP: In Python 2.1, Unicode literals can
only be written using the Latin-1 based encoding "unicode-escape".

The compatibility issue has to do with Latin-1.  And really there is
no compatibility problem, as new code written to work with old
interpreters can always use ascii encoding and escape sequences for
the rest.  It's just a matter of convenience.

Being a Latin-1 and Emacs user, all the convenience features will
benefit me.  However I would end up using the comment-like syntax in
all my source files also, so in the end it won't be convenient at all.

practicality-beats-purity-but-sometimes-purity-is-practical-ly y'rs,
Anders






More information about the Python-list mailing list