MHN
Add a comment on Hacker News →
1 of 17 comments
  1. 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...