This is a continuation to my previous article on things to do when writing a library or framework with Python that would make the code more maintainable and generic for extension.

Please check out my first post if not already.

Right of bat, let’s look at the problem statement.

  1. What if we are writing a library or a wrapper on top of a framework, where we are adding more functionalities to it but we would also want to make use of its underlying features without re implementing it.
  2. How to add extra capabilities for a class without modifying it or inheriting from it? Basically we do not want to add tight coupling between classes.

Let’s discuss how to tackle these issues one by one.

Intercepting the “ . ” while calling instance methods

Using Mixins to reduce tight coupling

#oop #programming-tips #python-programming #python

Python Object Oriented programming tips
1.15 GEEK