Deceptichum@quokk.au to memes@lemmy.worldEnglish · edit-222 days agothe glass is 2025-02-01 fullquokk.auexternal-linkmessage-square20fedilinkarrow-up11arrow-down10
arrow-up11arrow-down1external-linkthe glass is 2025-02-01 fullquokk.auDeceptichum@quokk.au to memes@lemmy.worldEnglish · edit-222 days agomessage-square20fedilink
minus-squareSpaceNoodle@lemmy.worldlinkfedilinkarrow-up0·edit-222 days agoThere’s nothing wrong with overloading an operator for other classes; the problem is the unexpected typecasting. Python, for example, will allow you to “add” strings to concatenate, but will throw a type error if you attempt to add a string to an integer.
There’s nothing wrong with overloading an operator for other classes; the problem is the unexpected typecasting.
Python, for example, will allow you to “add” strings to concatenate, but will throw a type error if you attempt to add a string to an integer.