Python assert — improved introspection of failure?
This is a rather useless assertion error; it does not tell the values of the expression involved (assume constants used are actually variable names): $ python -c "assert 6-(3*2)" [...] AssertionError Is there a better assert implementation in Python that is more fancy? It must not introduce additional overhead over execution (except when assert fails) .. and must turn off if -O flag is used. Edit : I know about assert's second argument as a string. I don't want to write one .. as that is encoded in the expression that is being asserted. DRY (Don't Repeat Yourself). Install your of function as