What a var __debug__? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What a var __debug__?

what is it? why it True

18th Aug 2018, 8:05 PM
Yan
Yan - avatar
1 Answer
+ 3
It's True on SoloLearn, which is the value when Python was started *without* an "O" option. From the documentation: https://docs.python.org/3/using/cmdline.html#cmdoption-o If I understand correctly, starting Python with -O sets __debug__ False and disables all asserts, which seems like a quick way to optimize for production / omit things like debug logging.
18th Aug 2018, 9:01 PM
Kirk Schafer
Kirk Schafer - avatar