0
Why do we use "@classmethod"?
I get the same results when I define a class method in the following two ways. 1-) Using @classmethod @classmethod def somemethod(cls) Some Codes 2-) Normally def somemethod() Some Codes In both ways I can reach the method using name of the class and I can do same operations using the method. The only difference is that I can call the method via object names when I declare the method in the first way. I think there should be some significant differences between these two methods. Is it?
1 Antwort
0
Yes ,there are difference between the first way ,he does a reference to class ,in first way the class can be taken in consideration to instantiate the object and second way no.