PEP: Defining Python Source Code Encodings

Bruce Sass bsass at freenet.edmonton.ab.ca
Tue Jul 17 17:37:07 EDT 2001


On Wed, 18 Jul 2001, Roman Suzi wrote:
> On Tue, 17 Jul 2001, Bengt Richter wrote:
>
> >I think you're right about #! triggering confusion, but I think a fixed keyword
> >as a prefix is helpful when e.g., grepping for files with directives.
> >
> >I withdraw my #!pragma (or #!pythma ;-) suggestion and propose
> >r'^\s*#pragma\s' as the magic line prefix regular expression.
>
> I think, this has no chance to be included into Python.
> Or Python will be messier than C++ is now.
>
> I do not believe pre-tokenizer directives are required...
>
> .spy things could be handled even now, so the overhead will
> be only for those who need it:
>
> --- file.spy ---
> #!/usr/bin/prepython
> #!pragma
>    $!pythma
> #!pyth on
> #!pyth off
> ...
> ...
> ----------------

But I want to feed it .lyx, or .txt, or .someproprietaryformat...
using .anythingspecific implies the file is an anythingspecific file,
and I will need a new tool to convert from .mything to
.anythingspecific.  e.g., It is trivial to arrange for a .lyx to have
an additional comment in its preamble, and everything would just work
without any tools aside from the actual filter|process needed to get
at the code.


- Bruce





More information about the Python-list mailing list