5 ms·
`self` is about being explicit with parameters. Rust does the same thing and that's a more "modern" language. The `__magic__` is about avoiding naming conflict
by ChrisSD 8y ago
`self` is about being explicit with parameters. Rust does the same thing and that's a more "modern" language.
The `__magic__` is about avoiding naming conflicts while still being explicit. It's a choice between magic or reserving a lot of names.
- steveklabnik 8y agoRust also has the issue of having three kinds of self, and those differences matter.
- pmontra 8y agoOr use normal method names chosen by the class author like for example Ruby and many other languages. In the case of the standard library it's easy to be consistent. I concede that in any other case it can be hard or impossible. About self, it's so strange to define a method with 2 arguments and call it with only one. Not only it's strange, it feels the opposite of being explicit. Most other languages manage to do without that self (Java, Ruby). I run into another oddity today. Yesterday if forgot about a = 0 if not a: print("like in C")