Description
In this course, you will :
- Discover how to use classes to represent data in a concise and natural manner. You'll also discover how to override built-in methods and make "inherited" classes that reuse functionality.
- Learn how to create class designs.
- Finally, you will be taught how to write automated tests for your own code, which is a good programming habit. If you are already familiar with Python fundamentals, such as those covered in the "Python Basics" and "Python Functions, Files, and Dictionaries" courses, this course is for you (courses 1 and 2 of the Python 3 Programming Specialization).
Syllabus :
1. Classes
- How to Use the Interactive Textbook
- User-Defined Classes
- Adding Parameters to the Constructor
- Adding Other Methods to a Class
- Instance Variable Search Order
- Example: Creating Instances from Data
- Converting an Object to a String
- Special (dunderscore) Methods
- Instances as Return Values
- Sorting Lists of Instances
- Class Variables and Instance Variables
- Thinking About Classes and Instances
2. Inheritance
- Inheriting Variables and Methods
- Overriding Methods
- Invoking the Parent Class's Method
3. Unit Testing and Exceptions
- The test.testEqual Function
- Return Value Tests
- Side Effect Tests
- Program Development with Test Cases
- Testing Classes
- Conclusion: Test Cases
- Exception Handling Flow-of-control
- When to use Try/Except
- Handling Different Exception Types
- Introduction to Django
- How Django Uses Classes and Inheritance