[Python-Dev] Re: PEP: Defining Unicode Literal Encodings (revision 1.1)
M.-A. Lemburg
mal@lemburg.com
Sat, 14 Jul 2001 18:04:04 +0200
Roman Suzi wrote:
>=20
> On Sat, 14 Jul 2001, M.-A. Lemburg wrote:
>=20
> >directive unicodeencoding =3D 'latin-1'
>=20
> >#!/usr/local/python
> >""" Module Docs...
> >"""
> >directive unicodeencoding =3D 'latin-1'
> >...
> >u =3D "H=E9ll=F4 W=F6rld !"
> >...
>=20
> Is there any need for new directive like that?
> Maybe it is possible to use Emacs-style "coding" directive
> in the second line instead:
>=20
> #!/usr/bin/python
> # -*- coding=3Dutf-8 -*-
> ...
I already mentioned allowing directives in comments to work around
the problem of directive placement before the first doc-string.
The above would then look like this:
#!/usr/local/bin/python
# directive unicodeencoding=3D'utf-8'
u""" UTF-8 doc-string """
The downside of this is that parsing comments breaks the current
tokenizing scheme in Python: the tokenizer removes comments before
passing the tokens to the compiler ...wouldn't be hard to=20
fix though ;-) (note that tokenize.py does not)
--=20
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Consulting & Company: http://www.egenix.com/
Python Software: http://www.lemburg.com/python/