Re: Implementing #define macros similar to C on python

2013-11-16 Thread Mark Lawrence
On 16/11/2013 05:38, JL wrote: On Saturday, November 16, 2013 8:22:25 AM UTC+8, Mark Lawrence wrote: Yes but please don't top post. Actually print is a statement in Python 2 so your code should work if you use from __future__ import print_function at the top of your code. Would you also be kin

Re: Implementing #define macros similar to C on python

2013-11-16 Thread Serhiy Storchaka
15.11.13 06:57, Chris Angelico написав(ла): On Fri, Nov 15, 2013 at 3:10 PM, Roy Smith wrote: Why would you want to? One of the most horrible things about C/C++ is the preprocessor. Hey, that's not fair! Without the preprocessor, how would you be able to do this: //Hide this part away in a

Re: Implementing #define macros similar to C on python

2013-11-15 Thread JL
On Saturday, November 16, 2013 8:22:25 AM UTC+8, Mark Lawrence wrote: > Yes but please don't top post. Actually print is a statement in Python > 2 so your code should work if you use > from __future__ import print_function > at the top of your code. > Would you also be kind enough to read and ac

Re: Implementing #define macros similar to C on python

2013-11-15 Thread Irmen de Jong
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 'pr

Re: Implementing #define macros similar to C on python

2013-11-15 Thread Mark Lawrence
On 15/11/2013 23: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? On Friday, November 15, 2013 11:49:52 AM UTC+8, Chris An

Re: Implementing #define macros similar to C on python

2013-11-15 Thread Terry Reedy
On 11/15/2013 6:36 PM, 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 Start your file with from __future__ import print_function and the above should work. Oh, and please snip stuf

Re: Implementing #define macros similar to C on python

2013-11-15 Thread JL
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? On Friday, November 15, 2013 11:49:52 AM UTC+8, Chris Angelico wrote: > On Fri, Nov 15, 2

Re: Implementing #define macros similar to C on python

2013-11-15 Thread Irmen de Jong
On 15-11-2013 3:29, JL wrote: > One of my favorite tools in C/C++ language is the preprocessor macros. > > One example is switching certain print messages for debugging use only > > #ifdef DEBUG_ENABLE > DEBUG_PRINT print > #else > DEBUG_PRINT > > Is it possible to implement something similar

Re: Implementing #define macros similar to C on python

2013-11-14 Thread Chris Angelico
On Fri, Nov 15, 2013 at 3:10 PM, Roy Smith wrote: > Why would you want to? One of the most horrible things about C/C++ is > the preprocessor. Hey, that's not fair! Without the preprocessor, how would you be able to do this: //Hide this part away in a header file somewhere struct b0rkb0rk {

Re: Implementing #define macros similar to C on python

2013-11-14 Thread Roy Smith
In article , JL wrote: > One of my favorite tools in C/C++ language is the preprocessor macros. > > One example is switching certain print messages for debugging use only > > #ifdef DEBUG_ENABLE > DEBUG_PRINT print > #else > DEBUG_PRINT > > Is it possible to implement something similar in p

Re: Implementing #define macros similar to C on python

2013-11-14 Thread Chris Angelico
On Fri, Nov 15, 2013 at 1:29 PM, JL wrote: > One of my favorite tools in C/C++ language is the preprocessor macros. > > One example is switching certain print messages for debugging use only > > #ifdef DEBUG_ENABLE > DEBUG_PRINT print > #else > DEBUG_PRINT > > Is it possible to implement somethi

Re: Implementing #define macros similar to C on python

2013-11-14 Thread Dave Angel
On Thu, 14 Nov 2013 18:29:48 -0800 (PST), JL wrote: One of my favorite tools in C/C++ language is the preprocessor macros. One example is switching certain print messages for debugging use only #ifdef DEBUG_ENABLE DEBUG_PRINT print #else DEBUG_PRINT Is it possible to implement some

Implementing #define macros similar to C on python

2013-11-14 Thread JL
One of my favorite tools in C/C++ language is the preprocessor macros. One example is switching certain print messages for debugging use only #ifdef DEBUG_ENABLE DEBUG_PRINT print #else DEBUG_PRINT Is it possible to implement something similar in python? Thank you. -- https://mail.python.org/