[Tutor] Anyway to do something like a #define in python?

Alan Gauld alan.gauld@blueyonder.co.uk
Fri Jul 25 03:16:02 2003


> Is there a python equivalent to the C #define?  

Thankfully no, Python has removed the need for such a 
dangerous and ill behaved construct. As indeed has C++ 
where the use of #define (and most other pre-processor 
directives) is deprecated(*).

Now what exactly were you thinking of doing with #define? 
Then we might be able to tell you how to do it safely
in Python :-)

Alan G
(*)If you want to see why #define is evil read the relevant 
chapter in Bjarne Stroustrup's excellent book "The Design 
& Evolution of C++"