From C
#define TEST_MODE1
#define TEST_MODE2
#ifdef TEST_MODE1
Code executed only in test mode 1
#endif
#ifdef TEST_MODE2
Code executed only in Test Mode 2
#endif
#ifdef TEST_MODE1
#ifdef TEST_MODE2
Code executed only in test mode 1 and 2
#endif
#endif
I use it a lot.
What are the methods in python-pycharm environment?
It's not just that you can't see it and don't just log it, but I want to treat it as if it's missing when the code interprets it.
https://stackoverflow.com/questions/560040/conditional-compilation-in-python I want to write something like #ifdef that I can write more intuitively than this.
python
https://stackoverflow.com/a/2987538/4439606
If you look at the answer here, there seems to be a pypreprocessor. Using this library
from pypreprocessor import pypreprocessor
pypreprocessor.parse()
#define debug
#ifdef debug
print('The source is in debug mode')
#else
print('The source is not in debug mode')
#endif
I think that's possible. I don't use Python often, so I don't know about the package, but I heard that it can be installed with PYPI. I think it would be good to go into the link and read it.
558 GDB gets version error when attempting to debug with the Presense SDK (IDE)
555 Understanding How to Configure Google API Key
558 Uncaught (inpromise) Error on Electron: An object could not be cloned
555 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
795 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.