#define (from C) in Python

Santiago Romero sromero at gmail.com
Thu Nov 12 11:43:29 EST 2009


Is there a Python version of C's language #define statements?

Example:

#define ReadMem( (x) )    memory[ (x) ]

 Instead of using a function, when you call to ReadMem(), the code is
INCLUDED, (no function is called, the "compiler" just substitues the
ReadMem( expression ) with memory[ (expression) ] .

 I want to avoid function calls to speed up a program by sacrifizing
the resulting size ...

 Is that possible?



More information about the Python-list mailing list