bartc <b...@freeuk.com> writes: > I do know that if I want to port some program (be it in Python or > C++), or simply try and understand it, if I see it's full of class > definitions or whatever, then I won't bother.
There was a time in the evolution of OOP when inheritance was thought of as a cool and enabling thing for code re-use, and lots of architecture astronautics involved designing deeply nested and complex inheritance hierarchies in programs. These days I think there's more accepted that inheritance is confusing and obscures the control flow in programs, that it was often mis-used, and that while there are still legitimate uses cases for it, it should be used sparingly. That helps quite a lot. C++ templates let you write generics that are often cleaner than using subclasses, though the design of templates can lead to awful code and notoriously bloated and useless error messages. The long-awaited Concepts extension should help some with that. Again though, like anything else, templates work best when used tastefully rather than willy-nilly. -- https://mail.python.org/mailman/listinfo/python-list