Compiler directives in the source
Andy Jewell
andy at wild-flower.co.uk
Wed Feb 5 17:42:41 EST 2003
What about a special module, maybe even metamodule, that allowed the
manipulation of such things? Rather like "from __future__ import ...",
maybe:
import __options__
__options__.optimize(True)
__options__.olddivision(0)
__options__.importsite(True)
__options__.verbose(False)
__options__.warnings(arg)
__options__.debug(False)
__options__.ignorecase(False)
__options__.path("dir;dir")
__options__.home(dir)
This would obviously fail on versions which didn't support it!
Maybe even a 'special' variable, perhaps a dict:
__options__={"optimize":True,
"olddivision":0,
"importsite":True,
"verbose":False,
"warnings":arg,
"debug":False,
"ignorecase":False,
"path":"dir;dir",
"home":"dir"
}
Most likely solution will break some fossil or other...
I personally think that the comment-pragma solution is too reminiscent of
older, less cultured languages.
The use of a special punctuation character to introduce such options seems to
me to be rather non-pythonic.
-andyj
More information about the Python-list
mailing list