class Test:
init_count = 0
def __init__(self):
Test.init_count += 1
print("T ", end="")
def __copy__(self):
print("(拷贝构造,不触发__init__)", end="")
new_obj = Test.__new__(Test)
return new_obj
if __name__ == "__main__":
a = Test()
import copy
b = copy.copy(a)