Use __debug__ in your code:
if __debug__:
print 'Debug ON'
else:
print 'Debug OFF'
Create a script abc.py with the above code and then
- Run with
python -O abc.py - Run with
python abc.py
Observe the difference.
Use __debug__ in your code:
if __debug__:
print 'Debug ON'
else:
print 'Debug OFF'
Create a script abc.py with the above code and then
python -O abc.pypython abc.pyObserve the difference.