[Python-Dev] Assigning to __debug__
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Fri, 30 Mar 2001 20:31:31 +0200
> I checked in a fix to IDLE too, but it seems you were using an
> externally-installed version of IDLE.
Sorry about that, I used actually one from CVS: with a sticky 2.0 tag
:-(
> Assigning to __debug__ was never well-defined. You used it at your
> own risk.
When __debug__ was first introduced, the NEWS entry read
# Without -O, the assert statement actually generates code that first
# checks __debug__; if this variable is false, the assertion is not
# checked. __debug__ is a built-in variable whose value is
# initialized to track the -O flag (it's true iff -O is not
# specified). With -O, no code is generated for assert statements,
# nor for code of the form ``if __debug__: <something>''.
So it clearly says that it is a variable, and that assert will check
its value at runtime. I can't quote any specific messages, but I
recall that you've explained it that way also in the public.
Regards,
Martin