Once again, let’s go to the actual article written by Robert C. Martin The Open-Closed Principle. This time the article does not have any redefinitions and cites a principle described in another book: Object Oriented Software Construction, Bertrand Meyer, Prentice Hall, 1988, p 23
This book first defines the open/closed principle and then proposes in another chapter to use inheritance to solve it. However, what was the real problem OCP is attempting to solve?
Do you see where it’s going? It talks mostly about compile-time dependencies and scaling development by not blocking other teams waiting on shared software artifacts. It speaks of specific lower-level languages like C and C++, where the number of fields, field order, and virtual functions affect the physical bits in the memory and may require recompilation. And I sense the waterfall approach here.
This is the most followed principle in libraries because every time a Django developer inherits from a Model, View, and other classes - it is OCP or at least can be put behind the OCP banner. But it’s different in “our code”.