[Python-Dev] Pragmas and warnings

Paul Prescod paulp@ActiveState.com
Sun, 17 Dec 2000 12:04:27 -0800


A couple of other threads started me to thinking that there are a couple
of things missing from our warnings framework. 

Many languages have pragmas that allow you turn warnings on and off in
code. For instance, I should be able to put a pragma at the top of a
module that uses string functions to say: "I know that this module
doesn't adhere to the latest Python conventions. Please don't warn me
about it." I should also be able to put a declaration that says: "I'm
really paranoid about shadowing globals and builtins. Please warn me
when I do that."

Batch and visual linters could also use the declarations to customize
their behaviors.

And of course we have a stack of other features that could use pragmas:

 * type signatures
 * Unicode syntax declarations
 * external object model language binding hints
 * ...

A case could be made that warning pragmas could use a totally different
syntax from "user-defined" pragmas. I don't care much.

 Paul