Python 3 - Implement Equality Checks In your Classes with __eq__

preview_player
Показать описание
In this video we look at how to use the under method ___eq__ to implement a simple equality check.

As mentioned, here's a free link to my course which normally retails at £40!

-------------
GET The Pythonistas Notebook as your learning companion!
--------------
--------------
JOIN for in-depth coding videos!
------------
Python 3 is an incredible language for beginners, and in each of these videos I am to bring a simple idea to you in short and easy to digest videos. I will be covering data types, control flow, looping, functions, comprehensions, variables, object orientation and much more.
------------
Have a request? Drop me a message!
Рекомендации по теме
Комментарии
Автор

It is fine to show what you can do with the __eq__ method, but I think it would have been a good idea to at least mention conventions of checking for equality, meaning checking for type etc.
Even though John may be 10 years old, he is never equal to an integer 😊 otherwise a fun example of how to modify a magic method

IGqy
welcome to shbcf.ru