[Python-Dev] directive statement (PEP 244)

Paul Prescod paulp@ActiveState.com
Mon, 16 Jul 2001 13:11:10 -0700

"M.-A. Lemburg" wrote:
> My point is that I don't see editors as an issue in this discussion.

There are two points where this touches editors:

 * if we keep the encoding consistent throughout the file then at least
a Unicode-aware text editor like Notepad or Visual Studio will be able
to do something intelligent with the files. The user will choose
"Shift-JIS" from their menu and go ahead.

 * if we make the directive easy for an editor to find the declaration,
we increase the liklihood of people writing editors that magically guess
the right encoding instead of requiring the user to instruct them.

The first is more important to me than the second.

> Sure, but a user would normally not expect his program to
> fail just because he removes a comment...



I am usually not a fan of putting semantic information in comments but
the practical difficulties in doing so in this case seem small. And the
benefit would be that we could require the declaration to precede the
first non-comment line in the file. That means that we (both the
tokenizer and editors) don't have to seach the file for the declaration.
We just read two lines and then give up.

Take a recipe. Leave a recipe.  
Python Cookbook!  http://www.ActiveState.com/pythoncookbook