This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients Lluís, r.david.murray, serhiy.storchaka, vinay.sajip
Date 2012-05-21.11:55:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1337601324.26.0.827967998169.issue14868@psf.upfronthosting.co.za>
In-reply-to
Content
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 :)
History
Date User Action Args
2012-05-21 11:55:24r.david.murraysetrecipients: + r.david.murray, vinay.sajip, serhiy.storchaka, Lluís
2012-05-21 11:55:24r.david.murraysetmessageid: <1337601324.26.0.827967998169.issue14868@psf.upfronthosting.co.za>
2012-05-21 11:55:23r.david.murraylinkissue14868 messages
2012-05-21 11:55:23r.david.murraycreate