Open acsor opened 5 years ago
I fully agree with you. Haven't used or seen such usage in Python outside debugging. Reading through https://mail.python.org/pipermail/python-list/2013-November/660568.html , especially the point that assert can be compiled away (through optimisations) probably is another good argument not to use asserts in this case, unless you don't care about them triggering.
A reasonable and descriptive exception seems way more appropriate to me.
While deploying unit tests for
filters.py
I have noticed that the use ofassert
is much more frequent than a reasonable exception. AFAIK, even in Python theassert
keyword has a wide use in debugging, but not when launching production code.Take for example filters.py:390 where I would substitute
with something like
Shall I, and all the other developers, take the freedom of changing these occurrences when stumbled upon and when it is reasonable to do so?