Skip to content

Commit 7abfd77

Browse files
committed
objectl类的特殊方法
1 parent ec6cfc3 commit 7abfd77

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

exercise/object_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def __init__(self, name, age):
99

1010
# __new__:用于创建对象
1111
def __new__(cls, *args, **kwargs):
12-
print('__new__被调用只需了,cls的id值为{0}'.format(id(cls)))
12+
print('__new__被调用了,cls的id值为{0}'.format(id(cls)))
1313
obj = super().__new__(cls)
1414
print('创建的对象的id为{0}'.format(id(obj)))
1515
return obj

0 commit comments

Comments
 (0)