4 ms·
Learning that these methods can be pronounced "dunder [foo]" flips a bit in my head from "Python, though a clean and predictable language, sure has a few ugly c
by ldh 13y ago
Learning that these methods can be pronounced "dunder [foo]" flips a bit in my head from "Python, though a clean and predictable language, sure has a few ugly conventions" to "Python conventions have a bit of quirky personality, I like that".
- yen223 13y agoI used to think they were ugly too, until I wrote a Python library which made heavy use of overloaded operators. I find that Python's magic methods are a surprisingly elegant way to implement class-specific operators and comparators, at least compared with other languages.