I use to define macros (not just constants) in C like
#define loop(i,a,b) for(i=a; i<b; ++i)
#define long_f(a,b,c) (a*0.123 + a*b*5.6 - 0.235*c + 7.23*c - 5*a*a + 1.5)
Is there a way of doing this in python using a preprocess instead of a function?
*By preprocess I mean something that replaces the occurrences of the definition before running the code (actually not the whole code but the rest of the code, because since it's part of the code, I guess it will replace everything during runtime).
If there is, worth it? Will there be a significant difference in run time?
cpp
in most POSIX-like systems. There are of course many other preprocessors available, M4 being the most notable these days. There are also other C-like preprocessors if you just search a little. However, most Python programmers would frown at you and your code if you used a preprocessor and macros like that. Most C programmers as well actually.