[Python-Dev] Idea of the Month: Preprocessor

M.-A. Lemburg mal@lemburg.com
Tue, 19 Mar 2002 10:10:11 +0100


Guido van Rossum wrote:
> 
> > Enable a command line option [-p filename.py] and a related
> > environment variable PYTHONPREPROCESS.  The new behavior of the
> > interpreter would then be to submit all of its input to the
> > preprocess program (a module written in pure python) and then
> > interpret the result.
> 
> Instead of encumbering the standard Python interpreter, why not write
> a script that runs its argument after preprocessing it, and inserts a
> preprocessor in __import__.

Or even more subtle: wait until PEP 263 phase 2 is implemented
and write a codec which does the preprocessing for you on a per
module basis, then you'd write:

#!/usr/local/bin/python
# coding: utf-8-with-macros
macro yadada(a,b,c):
    print a,b,c

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/