[Python-Dev] Pragma-style declaration syntax (original) (raw)

M.-A. Lemburg mal@lemburg.com
Mon, 28 Aug 2000 14:33:59 +0200


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.

Comments ?

Thanks,

Marc-Andre Lemburg


Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/