Hacker News new | ask | show | jobs
by BiteCode_dev 641 days ago
Python shouldn't need special lib to design by contract, `assert cond, "reason"` and `if __debug__` work very well for that.

Unfortunately, people don't know they are made to be stripped in prod with `-OO` so that the perf hit is zero. This means you can never be sure a 3rd party lib you depend on is not using an assert somewhere for a very important check you are going to disable.

https://www.bitecode.dev/p/the-best-python-feature-you-canno...

1 comments