Anything equivalent to cassert in C++?

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Fri Nov 27 04:41:48 EST 2009


Jean-Michel Pichavant a écrit :
(snip)
> I personally never use asserts in python, cause I will end up handling 
> with asserts what I should in fact handle properly in what you call the 
> production code.

Not the same concern. Assertions are here for 1/ documention of expected 
  state / value / pre|post conditions etc, and 2/ automatic verification 
of these expectations *during development* - so you can immediatly spot 
and fix failed expectations. IOW, it's about the  "this should not, no 
way, never possibly happen" cases, not the "this may eventually happen" 
ones - which indeed require "proper" handling at the level you expect them.





More information about the Python-list mailing list