Re:Why People Should Learn Python
by rdtsc on Wednesday August 24, 2016 @04:54AM
(#12350650)
It is a convention for protocols. There are others you see __len__, __eq__, __new__, __str__ and so on. It did seem odd at first (I learned, C, Java, C++) first. But then after a while saw how it fits in a consistent way in the language. Make many things simpler, fits with duck-typing, fits with how classes are constructed, and so on. Visually it stands out right away, you so you know by looking these are special methods (say instead of being called "init", "eq" or "new")
Felt the same way about "self" argument. But then now I really like it and see it as a very nice idea.
Felt the same way about "self" argument. But then now I really like it and see it as a very nice idea.