There's this error in Python when calling builtin type() with no arguments:
TypeError: type() takes 1 or 3 arguments
How can we define such a method? Is there a builtin way? Or we need to do something like this:
>>> def one_or_three(*args):
... if len(args) not in [1,3]:
... raise TypeError("one_or_three() takes 1 or 3 arguments")
...
>>> one_or_three(1)
>>> one_or_three()
TypeError: one_or_three() takes 1 or 3 arguments
>>> one_or_three(1,2)
TypeError: one_or_three() takes 1 or 3 arguments