Python Interfaces: Object-Oriented Design Principles (Summary)
Python offers great flexibility when you’re creating interfaces. An informal Python interface is useful for small projects where you’re less likely to get confused as to what the return types of the methods are. As a project grows, the need for a formal Python interface becomes more important as it becomes more difficult to infer return types. This ensures that the concrete class, which implements the interface, overwrites the abstract methods.
Now you can:
- Understand how interfaces work and the caveats of creating a Python interface
- Understand the usefulness of interfaces in a dynamic language like Python
- Implement formal and informal interfaces in Python
- Compare Python interfaces to those in languages like Java, C++, and Go
Now that you’ve become familiar with how to create a Python interface, add a Python interface to your next project to see its usefulness in action!
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.
00:00 Well done. You’ve made it to the end of the course. Python offers great flexibility when you’re creating interfaces. An informal interface is useful for small projects where you are less likely to get confused as to what the return types of the methods are.
00:15 As a project grows, the need for a formal Python interface becomes more important as it becomes more difficult to infer return types. This ensures that the concrete class, which implements the interface, overwrites the abstract methods.
00:29 You can now understand how interfaces work and the caveats of creating a Python interface, understand the usefulness of interfaces in a dynamic language like Python, implement informal and formal interfaces in Python, and compare Python interfaces to those in other languages such as Java, C++, and Go.
00:51 Now that you’ve become familiar with how to create a Python interface, add an interface to your next project to see its usefulness in action.
00:58 We hope you found this course useful, and we’ll see you again soon at realpython.com.
Become a Member to join the conversation.