3 ms·
but 1) it's "opt in" (you need to explicit implement the dunder method) and 2) it's only for specific classes, you cannot change the behavior of 1 == "one"
by _ZeD_ 6y ago
but
1) it's "opt in" (you need to explicit implement the dunder method) and
2) it's only for specific classes, you cannot change the behavior of 1 == "one"
- dragonwriter 6y ago> it's only for specific classes, you cannot change the behavior of 1 == "one" More clearly because builtins are protected from monkey-patching, you can’t change the behavior of == where both operands are builtins. “Only for specific classes” implies the scope of applicability is much narrower than it is.
- heavenlyblue 6y agoBut you can't do that for pattern matching either.