3 ms·
That's kind of the point. These methods are never meant to be called directly. They're used to desugar. I think it's fairly short sighted to criticize these. F
by parentheses 1y ago
That's kind of the point. These methods are never meant to be called directly. They're used to desugar.
I think it's fairly short sighted to criticize these. FWIW, I also did that the first time I wrote Python. Other languages that do similar things provide a useful transparency.
- NewsaHackO 1y agoI don’t think anyone is criticizing its utility, just that the syntax of 2-5(?) underscores in a row isn’t something that is DX friendly.
- dragonwriter 1y agoThe syntax is exactly two, not 2-5.
- JKCalhoun 1y agoI think the point was: who can know by looking at it.
- gcbirzan 1y agoI mean, maybe you should use a font that doesn't make it hard to figure that out. Next you're gonna say we should ban 0s and Os, Is and ls, because your font doesn't allow you to figure out which one it is.
- dragonwriter 1y agoAnyone using a monospacdd font, a font where underscores are separated, or a run-together proportional font that they are even a little bit familiar with, because of the relative width of underscores and other characters. Which, between them, covers approximately everyone.
- hiAndrewQuinn 1y agoThe ugliness is intentional. Nobody wants to name their cool new variable __hot__singleton__in__your__area__.
- globular-toast 1y agoThey are called dunder methods, meaning "double under". It's 2 underscores. I've had snippets in my editor for approximately 15 years at this point so I don't have to manually type any of the dunder methods. Would recommend!