Why assert is not a function?

David Lowry-Duda david at lowryduda.com
Wed Mar 3 12:35:24 EST 2021


> assert condition, expression
> 
> Only is condition is false with expression be evaluated.
> So you can safely do expensive things I the expression with incuring 
> and cost if the condition is True.

I think I've only every used a string as the expression. Have you found 
it useful to use complicated, expensive expressions? Could you give an 
example?

- DLD


More information about the Python-list mailing list