Veek M wrote: > Trying to make sense of that article. My understanding of debug was > simple: > 1. __debug__ is always True, unless -O or -OO > 2. 'if' is optimized out when True and the expr is inlined. > > So what does he mean by: > > 1. 'If you rebind __debug__, it can cause symptoms' > 2. 'During module compilation, the same code that handles literals > also handles the magic constants ..., None, True, False, and > __debug__' 3. 'you'll see that if __debug__: statements are either > removed entirely, or use LOAD_CONST to load the compile-time debug > constant, while if bool(__debug__): statements use LOAD_GLOBAL to load > the value of __debug__.' > > 4. 'Of course these are guaranteed to be the same⦠unless you rebind > __debug__' > > Basically every line in that answer is new to me.. Sorry for the awful title but I was not sure what to title it because I have no clue what they are talking about.. barring the fact that it's about __debug__ and assigning True/False to it..
Isn't that how you turn it off when you don't want -O ?? -- https://mail.python.org/mailman/listinfo/python-list