3 ms·
So far I've been using Obiwan [1] to check types during testing. It's definitely not something you want to do all the time, because it has a huge runtime cost.
by rspeer 11y ago
So far I've been using Obiwan [1] to check types during testing. It's definitely not something you want to do all the time, because it has a huge runtime cost.
[1] https://github.com/williame/obiwan https://github.com/williame/obiwan
What I do is I have my test runner look for the PYTHON_TYPECHECK environment variable, and if it's set, it imports and enables Obiwan.
I've caught a few subtle bugs this way.
- techdragon 11y agoThis is a job for the little used -O flag. Are there a any good libraries to turn on/off type checking using if debug as part of the decoration logic? If so then running with -O in production would solve some of the problem with this.