X
Xah Lee
i wanted to define a function where the number of argument matters.
Example:
def Range(n):
return range(n+1)
def Range(n,m):
return range(n,m+1)
def Range(n,m,step):
return range(n,m+1,step)
this obvious doesn't work. The default argument like
Range(n=1,m,step=1) obviously isn't a solution.
can this be done in Python?
or, must the args be changed to a list?
Xah
(e-mail address removed)
∑ http://xahlee.org/
Example:
def Range(n):
return range(n+1)
def Range(n,m):
return range(n,m+1)
def Range(n,m,step):
return range(n,m+1,step)
this obvious doesn't work. The default argument like
Range(n=1,m,step=1) obviously isn't a solution.
can this be done in Python?
or, must the args be changed to a list?
Xah
(e-mail address removed)
∑ http://xahlee.org/