Anything equivalent to cassert in C++?

Aahz aahz at pythoncraft.com
Thu Nov 26 12:43:13 EST 2009


In article <mailman.580.1258492799.2873.python-list at python.org>,
Peng Yu  <pengyu.ut at gmail.com> wrote:
>
>There are some assertion code (testing if a condition is false, if it
>is false, raise an Error object) in my python, which is useful when I
>test my package.  But such case would never occur when in the produce
>code. If I keep them in if statement, it will take some runtime. I'm
>wondering what is the practice that take care of the assertion code in
>python.

You should be very careful not to put unit tests in asserts because that
prevents you from testing your application under optimization.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

The best way to get information on Usenet is not to ask a question, but
to post the wrong information.  



More information about the Python-list mailing list