On Oct 2, 10:16 pm, process <[EMAIL PROTECTED]> wrote:
> Let's say I have a class X which has 10 methods.
>
> I want class Y to inherit 5 of them.
>
> Can I do that? Can I do something along the lines of super(Y, exclude
> method 3 4 7 9 10) ?

Don't use inheritance, use delegation or just copy the methods you
need:

class A(object):
  def meth_a(self):
     pass

class B(object):
   meth_a = A.meth_a.im_func


IMO, if you have methods that you want to use in different classes,
this is hint that
you are in need of generic functions. See this blog post for an
example:

http://www.artima.com/weblogs/viewpost.jsp?thread=237764
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to