Comment on Rust's Two Kinds of 'Assert' Make for Better CodeparentComments−BiteCode_dev1yIn Python, contract based programming can be only be done properly with asserts:- You can't use the type system for some constraints.- Asserts can be stripped in production so you don't pay the price for them.- There is not other syntax for that.Unfortunatly, because most devs don't know about "-O" and use asserts for things you should use an Exception for, you can't use it: https://www.bitecode.dev/p/the-best-python-feature-you-canno...
Comments
In Python, contract based programming can be only be done properly with asserts:
- You can't use the type system for some constraints.
- Asserts can be stripped in production so you don't pay the price for them.
- There is not other syntax for that.
Unfortunatly, because most devs don't know about "-O" and use asserts for things you should use an Exception for, you can't use it: https://www.bitecode.dev/p/the-best-python-feature-you-canno...