A PYTHON PREPROCESSOR

Cedric Adjih adjih at crepuscule.com
Thu May 18 14:28:02 CEST 2000


Courageous <jkraska1 at san.rr.com> wrote:
> Alex wrote:
>> 
>> Hi, Courageous.
>> 
>> What do you want to use a preprocessor for?  I can't think of any uses
>> that can't be affected in python itself.

> More of a theoretical challenge than anything. One advantage of
> a preprocessor is that it lets you do conditional sections,

Well you can use "if" or indirection. This is how "conditionnal"
code is done for the "os" module.
Much of the use of the C preprocessor comes from the fact you
can't execute statements when C interprets the declarations. This is
not true in Python.

>                                                             and
> in some cases avoid function invocation overhead.

Inlining could be much better done by the Python (byte-)compiler.
Perl does this.
Even C++ advises to use inline functions instead of 
macros because they are painful in a number of way.

> One thing I'm interested in is: is anyone interested in this?

  Macrology without respect to the structure of the language
is not a great idea, but Lisp/Scheme macros, and meta-object
protocols are interesting idea.

> If there are, I'm willing to hear a request for features.

Clean integration with Python :-)

-- Cedric



More information about the Python-list mailing list