Inheritance but only partly?

greg greg at
Fri Oct 3 11:28:40 CEST 2008

bearophileHUGS at 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 another possibility that's even more pythonish
(I won't say pythonic, since it's not necessarily
a *recommended* thing to do):

class A:
   m1 = B.__dict__['m1']
   m2 = B.__dict__['m2']

I propose calling this the Magpie pattern (stealing
the shiny baubles you want and hiding them away in
your own nest).


More information about the Python-list mailing list