assert versus print [was Re: The curious behavior of integer objects]

Neil Cerutti horpner at
Tue Jan 16 14:37:16 CET 2007

On 2007-01-16, Ron Adam <rrr at> wrote:
> I have to admit that part of why assert seems wrong to me is
> the meaning of the word implies something you shouldn't be able
> to ignore.  While warnings seem like something that can be
> disregarded.

Experienced C coders expect assert to behave like that.

The only reason (I know of) to turn off error checking is to
optimize. However, removing tests won't usually make a big enough
speed difference to be worth the burthen of testing two different
versions of the same source code.

So to me the assert statement is either dubious syntax-sugar or
dangerous, depending on Python's command line arguments.

The warning module would seem to have limited applications.
Searching my Python distribution shows that it's used for
deprecation alerts, and elsewhere for turning those selfsame
alerts off. How copacetic! It is the null module. ;-)

Neil Cerutti
Facts are stupid things. --Ronald Reagan

More information about the Python-list mailing list