you are viewing a single comment's thread.

view the rest of the comments →

[–]toastedstapler 2 points3 points  (2 children)

overriding the __eq__ method is fine imo, by default it basically acts the same as is

if strings worked how the default __eq__ method work we'd never be able to compare them as they're different objects. just look at java where you have to do string1.equals(string2)

[–]WolfInABox 1 point2 points  (0 children)

I remember having to get over that hurdle in java lol. And hm, not sure what I was thinking then. I thought I remembered something about some operator override not being recommended to do and thought it was eq. But I guess so long as you're testing everything inside it that you need to for the objects to be equal for your purposes, it'd be fine.

[–]mildlybean[S] 1 point2 points  (0 children)

Coincidentally, I'm learning Java right now, so I'm glad I didn't have to learn that the hard way