4 ms·
Care to name any 3rd party libs in particular?
by alshel 5y ago
Care to name any 3rd party libs in particular?
- zbentley 5y agoDjango Rest Framework.
- BiteCode_dev 5y agoNope, I just remember my server crashing years ago so I stopped ever since. Would be interesting to scan pypi and check if this is still a thing. Maybe create a bot warning lib authors.
- zarzavat 5y agoSeems like a better idea would be to make a separate flag "--remove-assertions" for people who desire that.
- BiteCode_dev 5y ago"-o" is mostly "--remove-assertions" already, so that wouldn't help. While today's use case for assert is unit testing, the actual killer feature of the keyword is that it's removed only from prod. The idea is that you can write things like function contracts, that are expensive, but only exist in dev. Now, if one of you dependencies use assert for something they expect to still be in prod, which is the problem we are talking about in the first place, "-o" or "--remove-assertions" will strip their assert too, breaking their code, and hence, yours since it depends on it.
- athrowaway3z 5y agoBefore this thread i had no idea assert was debug only in python. Another solution would be to accept the current role of assert as quick error checking and add in debug_assert to indicate a conditional error check. The biggest issue with that approach is that a majority will suddenly ask "Wait, python has a debug mode?"
- BiteCode_dev 5y agoNot because the -o mode also remove any block testing on "__debug__", and that's a very useful thing as well. The original feature is perfect. But there is 5 good years of educating users so it can be used.
- andi999 5y agoI still do not understand what the problem is and what users need to know. So assert throws and exception in debug mode and is 'commented out' in production, right? So the problem is some vendors ship libs that have failing asserts so cannot run in debug mode?
- human_error 5y agoStarlette, SQLAlchemy.