Comment on PEP 263 - Defining Python Source Code Encodings

David LeBlanc whisper at oz.net
Sat May 11 04:13:36 EDT 2002


Firstly it's NOT "invalid xml". It IS a well formed xml tag! It's not meant
to be or suggest a doctype declaration or an <?xml declaration.

Secondly, what existing editorS recognize this -*- syntax? (let me guess:
emacs). Can you cite a better reason for using this syntax then that it's
used by a particular platform-centric editor? I get the impression that you
chose this syntax out of convenience for the editor you use more then for
any generally useful reason. It might come as a surprise to you, but based
on OS installations around the world, more people program Python on Windows
then all the others combined and i'm willing to bet that most of them don't
use emacs or xemacs or a derivative thereof!

David LeBlanc
Seattle, WA USA

> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of Martin v. Lowis
> Sent: Saturday, May 11, 2002 0:46
> To: David LeBlanc
> Cc: Python-List at Python. Org; mal at lemburg.com
> Subject: Re: Comment on PEP 263 - Defining Python Source Code Encodings
>
>
> "David LeBlanc" <whisper at oz.net> writes:
>
> >     	To define a source code encoding, a magic comment must
> >     	be placed into the source files either as first or second
> >     	line in the file:
> >
> >           	#!/usr/bin/python
> >           	# -*- coding: <encoding name> -*-
> >
> >
> > why not use something like:
> >
> > 		#!/usr/bin/python
> > 		#<python version="2.2.1" encoding="utf-8" />
>
> What is the advantage of this notation? The advantage of the above
> notation is that existing editors already recognize it. Compared to
> your proposal, it has also the advantage that it is easier to type.
>
> > More generally, "utf-8" would be replaced by one of a list of acceptable
> > encoding names in the same way as currently envisioned by the
> PEP authors
> > (whatever that is - I didn't see it mentioned in the PEP).
>
> Any encoding is acceptable for which a codec is installed. For best
> portability, you need to restrict yourself to the encodings supported
> in your target Python release.
>
> > I think it has the very positive benefit of using what has rapidly
> > become a very familiar idiom
>
> Can you cite other examples of using invalid XML in programming
> language comments?
>
> > Do we really need yet _another_ notation?
>
> Precisely my question.
>
> Regards,
> Martin
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list






More information about the Python-list mailing list