Question about subclassing - version 2
bdesth.quelquechose at free.quelquepart.fr
Sat Sep 9 20:24:57 CEST 2006
Maric Michaud a écrit :
> Le vendredi 08 septembre 2006 10:15, Bruno Desthuilliers a écrit :
>>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.
I can imagine this too - as well as I can imagine the nightmarish
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
A partial implementation should return default values, not raise (aka
NullObjectPattern). Well, IMHO at least.
> And this can become a true spider net for more complicated cases. Obviously,
> in practice we will choose alternatives to inheritance (strategies,
> visitors, ...)
> to work with such complex situations,
More information about the Python-list