How to disable assert statements inside a module?

Just van Rossum just at xs4all.nl
Sun Mar 10 16:55:42 EST 2002


In article <m3henoqh5u.fsf at mira.informatik.hu-berlin.de>,
 martin at v.loewis.de (Martin v. Loewis) wrote:

> Pearu Peterson <pearu at cens.ioc.ee> writes:
> 
> > Is there a way to disable all assert statements inside a module,
> > and without calling python with -O switch?
> 
> You can set __debug__ to 0 on the module level; this will disable
> assert statements inside this module.

That's what I thought, too, but you get a SyntaxError in 2.2.

Unhelpfully,
Just



More information about the Python-list mailing list