define

Marcus Alanen marcus at infa.abo.fi
Thu May 8 12:37:14 EDT 2003


On Thu, 08 May 2003 15:10:38 +0100, Turhan Ozen <txo at cs.nott.ac.uk> wrote:
>Could you show me a simple macro pre-processor example or a web page 
>about it, please.

Well, technically you can use any preprocessor. How suitable it is
for Python development is another matter.

Example: test.p contains:

#define PH x[1]
PH = 3

Running "cpp -P test.p" produces exactly what you think it would,

x[1] = 3

Nothing special, no magic here. You might want to do makefile rules
for converting *.p files to corresponding *.py files, though.

Note: I'm definitely not suggesting you _should_ use the C preprocessor
for Python development.

Marcus





More information about the Python-list mailing list