Resolving how to give an attribute in a class in Python
问题 I have the following class: class Point(object): __slots__= ("x","y","z","data","classification") def __init__(self,x,y,z,n=None): self.x = float(x) self.y = float(y) self.z = float(z) self.data = [self.x,self.y,self.z] def set_classification(self,n): self.classification = n p = Point(10,20,30) p.data [10.0, 20.0, 30.0] p.set_classification(0) p.data [10.0, 20.0, 30.0] I have the following questions: First, the parameters to create the Point object are x,y , and z . Classification is an