This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
class InclusiveRange(): | |
def __init__(self, *args): | |
numargs = len(args) | |
if numargs < 1: | |
raise TypeError("invalid number of args, [1, 3] needed, got {}".format(numargs)) | |
elif numargs == 1: | |
self._stop = args[0] | |
self._start = 0 | |
self._step = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
def inclusive_range(*args): | |
numargs = len(args) | |
print("numargs: {}".format(numargs)) | |
if numargs < 1: | |
raise ValueError("number of args less than 1, needed interval [1, 3]") | |
elif numargs == 1: | |
start = 0 | |
stop = args[0] | |
step = 1 |