Implementing #define macros similar to C on python

Irmen de Jong irmen.NOSPAM at xs4all.nl
Fri Nov 15 19:20:25 EST 2013


On 16-11-2013 0:36, JL wrote:
> Thanks! This is the answer which I am seeking. However, I am not able to get the following line to work. I am using python 2.7.5
> 
> debug_print = print
> 
> Can we assign a function into a variable in this manner?

Yes, functions are just another object. But 'print' is only a function as of Python 3.
For your version, try adding this as the first line:
from __future__ import print_function

Irmen




More information about the Python-list mailing list