When to use assert

Tim Chase python.list at tim.thechases.com
Sun Nov 17 13:50:56 CET 2013


On 2013-11-17 07:35, Steven D'Aprano wrote:
> py> x = 23
> py> assert x > 0, "x is not zero or negative"

This is the worst way to use an assertion:  with a misleading
message ;-)

-tkc





More information about the Python-list mailing list