5 ms·
Can you elaborate bit what is the problem here? Is it shape of the characters or something else?
by timeon 1y ago
Can you elaborate bit what is the problem here? Is it shape of the characters or something else?
- brabel 1y agoAmazing. If you need to ask this question I am guessing you have spent too long with Python . No other language uses this underscore madness for special methods or otherwise. Because it’s just , I don’t know a more appropriate word for it , stupid.
- deleted 1y ago[deleted]
- Octoth0rpe 1y agoOh yes they do: https://www.php.net/manual/en/language.oop5.magic.php https://www.php.net/manual/en/language.oop5.magic.php The programming languages world is broad/varied enough that any statement like "no other language does this!" is almost certainly wrong (outside of esoteric languages, which python and php most certainly are not)
- deathanatos 1y agoLua, too: __add, __sub, __mul, __div, __mod, __pow, __unm, __idiv __band, __bor, __bxor, __bnot, __shl, __shr __concat, __len __eq, __lt, __le __index, __newindex, __call __gc, __close, __mode, __name
- Twirrim 1y agoWhat's actually amazing is how you're unable to answer a straight question. If you call something "stupid" it doesn't really convey anything meaningful, especially not in the way you're using there, it comes across as "I don't actually have a reason I don't like it, I just don't".
- DrJosiah 1y agoI mean, Python is dynamic. Here, have this: https://gist.github.com/josiahcarlson/39ed816e80108093d585df94f2dbc8b7 https://gist.github.com/josiahcarlson/39ed816e80108093d585df... Now you don't need to write your double-underscore methods ever again, if you don't want to.
- thesuperbigfrog 1y agoMost C and C++ compilers use similarly named macros: https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macro...
- c6401 1y agoJS used to have those, now they are deprecated though: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__#examples https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... so it settled on having this syntax for similar cases using "Symbol": class Foo { *[Symbol.iterator]() { yield 1; yield 2; yield 3; } } https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#static_properties https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...