Assertion vs. try-except

Thomas Weholt thomas at cintra.no
Fri Oct 20 07:22:46 EDT 2000


Hi,

Just wondering what the benefits of assert is, compared to doing a
try-except for instance. The documentation says :
"Assert statements are a convenient way to insert debugging assertions
into a program"

All nice and handy, but is this debugging specific ( should they be
removed when testing / debugging is over, if that will ever happen ??
) ? Why not use a try-except instead and print / handle errors? 

It's short and sweet, but are there any drawbacks in using assert this
way?





More information about the Python-list mailing list