- [Instructor] It is also possible to implement…comparison operators using our special class methods…to allow objects to compare themselves…to other objects of the same type.…So, this table lists the names of…the special class function that you can override…to provide comparisons, and you can see…that there are methods for greater than, less than,…greater or less than or equal, and so on.…Each of these methods compares the object…that the method is being called on…to the object specified by the parameter named other,…and you can see the type of comparison…expression that triggers that particular…function in the right-hand column.…
So let's take these for a test drive.…The code for this example is in…comparison underscore start dot py in the classes folder,…and at the top of the file you can see…that I have a class definition for employee,…and that it specifies a first and last name,…an employee level, and years of service.…I also have placeholder functions for…the various comparison functions,…and in the main function I have…
- Truth value testing
- Template strings
- Advanced Python functions
- Advanced collections
- Advanced classes and objects
- Python comprehensions: list, dictionary, and set
Skill Level Advanced
1. Python Language Features
2. Built-In Functions
3. Advanced Python Functions
4. Advanced Collections
5. Advanced Classes and Objects
6. Using Logging
7. Python Comprehensions
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.