我有以下代码:
class NumberAdder:
def adder(self, *args):
self.sum = 0
for i in args:
self.sum += i
return self.sum
class StringAdder:
def adder(self, *args):
self.word = []
for i in list(args):
self.word.append(i)
print(self.word)
class ThingsAdder:
def __init__(self, *args):
self.box = args
def stringAdder(self):
a = StringAdder()
a.adder(self.box)
def numberAdder(self):
a = NumberAdder()
a.adder(self.box)
c = ThingsAdder(1,2,3,4,5,6,9)
c.numberAdder()
问题是你可以看到我将* args分配给另一个* args。我应该怎么做才能使NumberAdder类中的* args接收解压缩(不是以元组的形式)参数?