PEP: Defining Python Source Code Encodings

Bengt Richter bokr at accessone.com
Tue Jul 17 13:13:09 EDT 2001


On Tue, 17 Jul 2001 12:08:58 +0200, "M.-A. Lemburg" <mal at lemburg.com> wrote:
[...]
>
>Issues that still need to be resolved:
[...]
>
>- which format to use for the magic comment, e.g.
>
>  * Emacs style:
>
>      #!/usr/bin/python
>      # -*- encoding = 'utf-8' -*-
>
>  * Via meta-option to the interpreter:
>
>      #!/usr/bin/python --encoding=utf-8
>
>  * Using a special comment format:
>
>      #!/usr/bin/python
>      #!encoding = 'utf-8'
>
If you go with the last line above, ISTM that it should
spawn a PEP of its own, because people will inevitably
think of other uses, e.g.,
       #!numbers = float_div
etc.

Rather than deal with a proliferation of #!xxx ideas, ISTM
a single form could anticipate most in an open-ended way, e.g.,

       #!pragma encoding('utf-8')

Some uses would have to be confined to programLines[1:n]
but there might be localized uses as well.

Perhaps it should be #!pythma for better acceptability? ;-)




More information about the Python-list mailing list