#define (from C) in Python

Michele Simionato michele.simionato at gmail.com
Thu Nov 12 17:53:26 CET 2009

On Nov 12, 5:43 pm, Santiago Romero <srom... at gmail.com> wrote:
> 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?

Python is a slow language and people usually do not even think of such

More information about the Python-list mailing list