Maric Michaud a ?crit :
Hummm, some more thoughts about this.
I can imagine class hierarchies where the presence of not implemented methods
doesn't mean that the class is actually an abstract one.
Le vendredi 08 septembre 2006 10:15, Bruno Desthuilliers a ?crit :
You
mentioned NotImplementedError, which is indeed the usual way to make
something "abstract" in Python.
You
mentioned NotImplementedError, which is indeed the usual way to make
something "abstract" in Python.
Hummm, some more thoughts about this.
I can imagine class hierarchies where the presence of not implemented methods
doesn't mean that the class is actually an abstract one.
spaghetti code that could use this class hierarchie.
Even if partial
implementation is not a common scheme it can save you from writing a lot of
classes.
A partial implementation should return default values, not raise (akaimplementation is not a common scheme it can save you from writing a lot of
classes.
NullObjectPattern). Well, IMHO at least.
(snip)
And this can become a true spider net for more complicated cases. Obviously,
in practice we will choose alternatives to inheritance (strategies,
visitors, ...)
Composition/delegation...
to work with such complex situations,
Indeed.in practice we will choose alternatives to inheritance (strategies,
visitors, ...)
Composition/delegation...
to work with such complex situations,