I see tornado has a chat room demo, the class Messagemixin method calls using the Cls= class, CLS. method, the way to self. The method seems to be no different from the previous invocation, do not know whether there is any deep difference between the two methods?
Reply content:
An article I've written.
What is method?
function is a piece of code that can be called by name, and we can pass parameters in to get the return value. All parameters are explicitly passed in the past.
method is the combination of function and object. When we call a method, some parameters are implicitly passed in the past. This is detailed below.
Instancemethod
In [5]: class Human(object): ...: def __init__(self, weight): ...: self.weight = weight ...: def get_weight(self): ...: return self.weight ...: In [6]: Human.get_weightOut[6]:
Suppose there is a Class C, and O is an object of Class C, then
Although there is a slight difference in the implementation process, the results say that
O.method (ARG, ...) is equivalent to C.method (O, arg, ...)
Have not understood the question, first Google and ask first, two kinds of ways what is the difference?
By the way, to help you to correct the case, no thanks.