Why assert is not a function?

Ethan Furman ethan at stoneleaf.us
Thu Mar 11 17:09:29 EST 2021


On 3/11/21 1:45 PM, dn via Python-list wrote:

> Is assert so much faster/cheaper than try...except...raise?

Infinitely faster when they are not there.  ;-)

Basically, you are looking at two different philosophies:

- Always double check, get good error message when something fails

vs

- check during testing and QA, turn off double-checks for production for best performance possible.

--
~Ethan~


More information about the Python-list mailing list