At 4/3/2001 06:54 AM, you wrote: > What do you mean by "exclude"? The same way -OO excludes doc-string from the source code, i.e.: it is optimized away by the compiler, and never gets into the object code/loaded into memory/executed. > If this were C, > I'd say that you could just use "#if 0" around the > test blocks for when you ship production code. > The quick way is to convert: > > some_test_code() > > into > > if None: > some_test_code() > > if that's OK with you. That way it will never be > executed. How else you would do it depends on your > definition of "excluded". You could hide it in > another module, or just cut it out altogether. After being advised by Steve Purcell, I think I will go with something like 'if __DEBUG__' instead of 'if 0' or '#if DEBUG' (running the Python source through cpp first), so clients _can_ execute the test code. Thanks, Steve
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4