Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

__eq__()

Zarata on Aug. 11, 2020

I like your presentations BTW – great content, style, clarity. That said, I found the mention of “Calls the method on the left hand operand … unless …”, a little challenging, i.e. “Now how does that work?”. I didn’t remember or hadn’t picked up the “rules” from the ‘other’ (sick recursive use of the word) tutorials on subclassing re: resolution as to which object is assigned to the “self” and to the “other” arguments of a dunder when a dunder backs some operator in an expression. I guess I’ll pull up the REPL to see what happens with SillyString("a") == SillyString("b")

Liam Pulsifer RP Team on Aug. 11, 2020

Thanks for the compliment, @Zarata! These resolution rules can be quite complex, and I don’t pretend to have them fully committed to memory. I think playing around in the REPL is a great solution, and if that doesn’t answer all of your questions, I would head straight to the documentation here and look around there.

Become a Member to join the conversation.