I was wondering if I could something like this in Python:
def func(val1,val2=val1):
#do whatever you want
I could do the following:
def func(val1,val2=None):
val2 = val1 if val2 == None else val2
#do whatever you want
But is there a more efficient/sexier way to do it?
Edit: I don't think the linked question is close to what I am asking. What I am searching for is the right way to set a function's default parameter value to the value of another parameter