Inheritance but only partly?
greg
greg at cosc.canterbury.ac.nz
Fri Oct 3 05:28:40 EDT 2008
bearophileHUGS at lycos.com 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).
--
Greg
More information about the Python-list
mailing list