Verifying assertion failures

Alex new_name at mit.edu
Sat May 19 12:07:18 EDT 2001


> I mean, it'd be nice to have something like:
> 
> >>> try:
> ...   assert 0 == 1
> ... except AssertionError, e:
> ...   print e
> ...
> 0 == 1

Why do you want to do that?  Usually, you use assertions for things you
believe are necessarily true.  For other situations, you usually throw
some more pertinent exception.

Alex.




More information about the Python-list mailing list