Can these two Python functions:
def negativeList(a):
return [-e for e in a]
def negativeTuple(a):
return tuple(-e for e in a)
be replaced by an equvalent single generic function negative(a)
?
You can determine the type at run time
def negative(a):
return type(a)(-e for e in a)