How to hide/remove some methods in inherited class in Python?

python

Solution

Here is the answer form of my comment: You can inherit both A and B from a third class, C. Like that:

class C(object):
  def someMethodToShow():
    pass

class A(C):
  def someMethodToHide():
    pass

class B(C):
  pass

As a side note, if what you wanted were possible, it would break the polymorphism. This one won't.

Problem

I want to hide some public methods during inheritance `class B` from `class A`: ``` class A(object): def someMethodToHide(): pass def someMethodToShow(): pass class B(A): pass len(set(dir(A)) - set(dir(B))) == 1 ``` How to do it in python if it possible?

Original source

Related problems