Best practice for using assert?
Is there a performance or code maintenance issue with using assert as part of the standard code instead of using it just for debugging purposes?
Is there a performance or code maintenance issue with using assert as part of the standard code instead of using it just for debugging purposes?
What does assert mean? How is it used?
How do I disable assertions in Python?
This is what I normally do in order to ascertain that the input is a list/tuple – but not a str. Because many times I stumbled upon bugs where a function passes a str object by mistake, and the target function does for x in lst assuming that lst is actually a list or tuple.
Let’s say that I have a class Suit and four subclasses of suit: Heart, Spade, Diamond, Club.