Thanks for all repliers:
@Tony & @Cameron, I do know related stuffs about the dunder methods, and your 
explanation just make it to be more clear, thank you!
@Roel, you just caught everyone here, we do miss it even though we know it and 
use it regularly!

@Clara
> its both, depending on how you're getting it.
Might can be more clear: its both, depending on how you're using/getting it.

And I think I can mark this question as resolved, and with the following 
conclusions:
As @Clara mentioned, we need to know that "all methods are functions", so we do 
can call `__init__` as a method or a function, or we can be avoid to have such 
discussion like Dan, and call it "the initializer" (However, you will need to 
think about “what is this is” for other functions :). ).
As @Alan mentioned, and according to the Wikipedia, in computer programming 
field, "method" is:
> A method in object-oriented programming (OOP) is a procedure associated with 
> an object, and generally also a message. An object consists of state data and 
> behavior; these compose an interface, which specifies how the object may be 
> used. A method is a behavior of an object parametrized by a user.

For `__init__` and other functions  in classes, we usually use them by writing 
code `obj.action()`, so we usually will call them as methods, so here, we call 
`action` or `__init__` as a method.
However, if you use them by writing code `Clz.action(obj)`, then you'd better 
(or must?) to call them as functions, and it is not a "daily use case" in daily 
development, and in some languages, this behavior won't even be possible.
**So, its kinda a "Majority rule" to call `__init__` (functions in classes) as 
a method.**

===
BTW, in Wikipedia, the "static methods" section is a very interesting:
> Static methods are meant to be relevant to all the instances of a class 
> rather than to any specific instance.
This explanation might can "group" some functions back to "methods" :) However, 
let's still remember:
All methods are functions, but not every function is a method.

Thanks again for helping, you guys are really nice!

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to