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) ?
--
http://mail.python.org/mailman/listinfo/python-list
process 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) ?
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
No.
But why do yo care? Yo
On Oct 2, 1: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) ?
I think the noral way of doing that is to split the ori
Gary Herron wrote:
> process 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) ?
>>
>> --
>> http://mail.python.org/mailman/listinfo/python-list
On Oct 2, 3: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) ?
That implies that the 5 you do include don't rely on or
Gary Herron:
> You can also redefine the ones you don't want inherited:
> class A:
> def DontInheritMe(self, ...):
>...
> Class B(A):
> def DontInheritMe(self, ...):
>raise NotImplementedError // Or some such
I have never used something like this, but the OP may use a maski
[EMAIL PROTECTED] wrote:
class Mask(object):
def m3(self): raise NotImplementedError
def m4(self): raise NotImplementedError
What's the name of this python design pattern? :-)
Don't know. Perhaps we could call it the FigLeaf pattern
(covering up what you don't want seen)?
There's a
greg wrote:
>> class Mask(object):
>> def m3(self): raise NotImplementedError
>> def m4(self): raise NotImplementedError
>
>> What's the name of this python design pattern? :-)
>
> Don't know. Perhaps we could call it the FigLeaf pattern
> (covering up what you don't want seen)?
Braghettone ;)
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
2008/10/2 process <[EMAIL PROTECTED]>:
> 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?
As others have said, no. What nobody seems to have said yet is why. If
Y descends from X, you are saying that Y is an X; that a Y can be used
anywhe
2008/10/3 Tim Rowe <[EMAIL PROTECTED]>:
> As others have said, no. What nobody seems to have said yet is why. If
> Y descends from X, you are saying that Y is an X; that a Y can be used
> anywhere an X can. If Y doesn't support some methods of X then it is
> *not* an X, and *can't* be used anywher
On Fri, 03 Oct 2008 03:32:52 -0700, Michele Simionato wrote:
> 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
That's a
On Oct 3, 11:56 pm, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> On Fri, 03 Oct 2008 03:32:52 -0700, Michele Simionato wrote:
> > 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
13 matches
Mail list logo