R. David Murray <rdmur...@bitdance.com> added the comment:

I was definitely wrong about the "obvious" part, then.  The 'if __debug__:' 
idiom is completely optimized away by -O, just like asserts are.  That is, in 
-O mode, there is no if test, the code block is just omitted entirely.

Having said that, though, I can't find it documented other than by the implicit 
equivalence given in the assert docs.

Hmm.  Yes, it does seem to be a CPython implementation detail.  See issue 8379. 
 Assert being removed is also an implementation detail, though (see the 
reference to "the current code generator..." in the assert docs).  I suppose 
that '-O' itself is a CPython implementation detail, in a sense :)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14868>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to