清单1
class MyClass:
def set(self, x, y):
self.x = x
self.y = y
obj = MyClass()
obj.set(10, "Integer")
print(obj.x)
print(obj.y)
列表-2
class MyClass:
pass
obj = MyClass()
obj.x = 10
obj.y = "Integer"
print(obj.x)
print(obj.y)
列表-3
class MyClass:
x = 0;
y = ""
def set(self, x, y):
self.x = x
self.y = y
obj = MyClass()
obj.set(10, "Integer")
print(obj.x)
print(obj.y)
这三个列表之间是否有实用差异?
这三个列表之间的理论有什么区别?