[Python-3000] Generic function PEP won't make it in time

Bill Janssen janssen at parc.com
Thu Apr 26 19:31:14 CEST 2007


> But it makes sense in some cases to insist that someone who goes
> through the trouble of inheriting from an ABC gets an error if they
> forget to implement one of the methods that are deemed 'essential' to
> that ABC.

This is the problem with abstract methods.  What should happen is that
the default method (the one defined in the ABC class) gets called.
Otherwise you're back in the morass of Java types, without effective
mixin capability.  In Python, we need to be able to define an abstract
class with real implementation methods -- a class that both defines an
interface, and provides an implementation.  That means that anyone
providing a subclass need only implement the methods that they
override.

Now, we can still have a way of marking the methods of an ABC as being
"not implemented", which would in fact force the subclass designer to
implement them.  But this concept should be carefully separated from
the concept of "this method is part of the interface defined by this
class".

Bill


More information about the Python-3000 mailing list