How can the built-in range function take a single argument or three?
Range takes, 1, 2, or 3 arguments. This could be implemented with def range(*args), and explicit code to raise an exception when it gets 0 or more than 3 arguments. It couldn’t be implemented with default arguments because you can’t have a non-default after a default, e.g. def range(start=0, stop, step=1). This is essentially because … Read more