class Test(object):
def __init__(self, *args):
print(args)
print(*args)
t = Test(1, 2, 3)
class Test1:
def __init__(self, name, age):
print(name, age)
t1 = Test1('zhangsan', 20)
class Test2:
def __init__(self, name):
self.name = name
print('init ' + name)
def __new__(cls, *args, **kwargs):
print('new')
cls.__init__(cls, args[0])
cls.__init__(cls, *args)
return cls
t2 = Test2('lisi')
class Test3:
def __init__(self, name):
self.name = name
print('init')
def __new__(cls, *args, **kwargs):
print('new')
return cls
t3 = Test3('lisi')