This shit is the reason people hate python. Things would be fine if you all would just behave, but because someone can eventually someone will even if they really shouldn't but if it works sometimes you can get away with it.
Then some poor asshole is up till 2am debugging some fucking thing he can't figure out because the code is deceptive.
You can have different data types without them being based on an object-oriented paradigm. For instance, haskell allows supplying implementations of various operators for user-defined types through type classes (which are not the same thing as classes in an object-oriented language like C++ or Java). In haskell, operators are just functions, so this is just a special case of ad-hoc polymorphism using type classes more generally.
Just wait until you see some JavaScript someone got clever on. The language has so many built in bad practices it's rare to not have to worry about them lol.
Some of my favorite reasons:
You can redefine undefined in older language versions
Setting a high index on an array changes the length of the array to index+1. 1 element at index 1000? Cool the length is 1001, and everything else is undefined.
All kinds of type coercion weirdness if you ever forget triple equals.
Anything on any object can be hot patched swapping out methods, properties, whatever and can be done in completely unrelated code. Want String to operate different? Go for it. I could go on.
The one thing I will say about that is that at least it is so pervasive in JS that all of the developers are trained not to trust the code and most behave accordingly.
Which is fine until someone who doesn't know JS very well comes along and fuck's everything up.
View all comments
Show parent comment
32
u/halfanothersdozen Jan 15 '22
This shit is the reason people hate python. Things would be fine if you all would just behave, but because someone can eventually someone will even if they really shouldn't but if it works sometimes you can get away with it.
Then some poor asshole is up till 2am debugging some fucking thing he can't figure out because the code is deceptive.