[Python-3000] __debug__

Thomas Heller theller at ctypes.org
Thu May 31 21:59:28 CEST 2007

Brett Cannon schrieb:
> On 5/31/07, Georg Brandl <g.brandl at gmx.net> wrote:
>> Guido just fixed a case in the py3k branch where you could assign to
>> "None" in a function call.
>> __debug__ has similar problems: it can't be assigned to normally, but via
>> keyword arguments it is possible.
>> This should be fixed; or should __debug__ be thrown out anyway?
> I never use the flag, personally.  When I am debugging I have an
> app-specific flag I set.  I am +1 on ditching it.
> -Brett

I would very much wish that __debug__ stays, because I use it it nearly every larger
program that I later wish to freeze and distribute.

"if __debug__: ..." blocks have the advantage that *no* bytecode is generated
when run or frozen with -O or -OO, so the modules imported in these blocks
are not pulled in by modulefinder.  You cannot get this effect (AFAIK) with
app-specific flags.


More information about the Python-3000 mailing list