From: David Garamond Date: 2002-08-24T16:14:14+09:00 Subject: Re: equivalent of python's __debug__ Shirai,Kaoru wrote: >>if __debug__: >> print "there are %d eggs in the basket now." % (eggs) >>will be optimized away. >>is there similar thing in ruby? or do i have to use a preprocessor? > > Interpreter switch '-d' and $DEBUG may help you. This may be good for > tiny script, but running large application with -d switch is often so > verbose. I recommands you to use some logger library. sorry for the late response. my problem is, i want to insert lots of string literals (sort of embedded documentation, but will be read by other scripts) which i don't want to include in the optimized version. in python, if i do this: def foo(self, x, y): if __debug__: self.__doc__x = "...some longish string..." self.__doc__y = "...some also longish string..." self.__doc_spec1__ = "...yet another string..." ... ... then the debug portion along with the literals will be removed so they don't take up memory. i don't seem to be able to do this with ruby, except by using a preprocessor. -- dave