I am writing a class whose __init__
uses either an id OR a slug argument but not both. I'd like to verify that the arguments are as expected. Is it proper, and good-practice to use an assert
for the specific purpose of verifying an assumption about arguments, or should I be raising an exception if the arguments aren't as expected?
e.g.,
def __init__(self, id=None, slug=None):
assert((id or slug) and not (id and slug))