[Python-Dev] Pragma-style declaration syntax
Guido van Rossum
guido@beopen.com
Mon, 28 Aug 2000 12:09:30 -0500
> I've been tossing some ideas around w/r to adding pragma style
> declarations to Python and would like to hear what you think
> about these:
>
> 1. Embed pragma declarations in comments:
>
> #pragma: name = value
>
> Problem: comments are removed by the tokenizer, yet the compiler
> will have to make use of them, so some logic would be needed
> to carry them along.
>
> 2. Reusing a Python keyword to build a new form of statement:
>
> def name = value
>
> Problem: not sure whether the compiler and grammar could handle
> this.
>
> The nice thing about this kind of declaration is that it would
> generate a node which the compiler could actively use. Furthermore,
> scoping would come for free. This one is my favourite.
>
> 3. Add a new keyword:
>
> decl name = value
>
> Problem: possible code breakage.
>
> This is only a question regarding the syntax of these meta-
> information declarations. The semantics remain to be solved
> in a different discussion.
I say add a new reserved word pragma and accept the consequences. The
other solutions are just too ugly.
--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)