4 ms·
I'd love to do this in Python, but unfortunately we can't. assert is supposed to be cheap in production because you remove them there. In python, this is done
by BiteCode_dev 3y ago
I'd love to do this in Python, but unfortunately we can't.
assert is supposed to be cheap in production because you remove them there.
In python, this is done python passing the "-oo" flag to the interpreted.
Unfortunately, the community never got the memo:
- if you put it in a lib, nobody is going to use "-oo" in prod, and they will think your lib is very slow
- if you using it in prod, some of your 3rd party deps may very well be using "assert" to make required production sanity checks. So using "-oo" would suddenly break your system.
- biorach 3y ago> I'd love to do this in Python, but unfortunately we can't. > assert is supposed to be cheap in production because you remove them there. well... Python is so slow that are you going to notice the overhead of assert calls? (Not being negative, I really like Python)
- BiteCode_dev 3y agoOf course. Python is a great glue language, so you will do most of the expensive call outside of Python. However, things you typically put in assert are usually pure Python you call repeatedly, putting you in the worse of both worlds.