On Nov 19, 2016 11:22 AM, "Victor Porton" <por...@narod.ru> wrote:
Consider class FinalTreeNode(object): def childs(self): return [] class UsualTreeNode(FinalTreeNode) def childs(self): return ... In this structure UsualTreeNode derives from FinalTreeNode. This looks odd because "final" in OOP usually denotes something that will not be further inherited. Is it better to introduce an extra base class? Without knowing what UsualTreeNode and FinalTreeNode are it's hard to say. class BaseTreeNode(object): def childs(self): return [] # The same functionality as BaseTreeNode, but logically distinct class FinalTreeNode(BaseTreeNode): pass That's a bit of a code smell. Why do you need a subclass if the implementation is the same? Probably you should implement the common parts in the base class and differentiate both of the subclasses. Also a pet peeve of mine is the word "base" in class names. Just call it TreeNode. -- https://mail.python.org/mailman/listinfo/python-list