[Python-3000] Implementations: A syntax for extending method dispatching beyond type/class inheritance
python3000 at davious.org
Thu Dec 7 17:22:47 CET 2006
on 12/7/2006 10:57 AM Hasan Diwan wrote:
> On 07/12/06, Dave Anderson <python3000 at davious.org> wrote:
>> I feel on a different page from you.
>> My best guess it is that
>> def typeOfSuper(self):
>> is ceding its implementation to its subclasses, kind of like what an
>> abstract class or interface would do
>> but I feel my guess is wrong. Please clarify.
> No, that is spot-on.
The Implementations syntax sketch has no need for abstract classes,
since concrete classes serve as the interfaces. Still, in the syntax,
one could simply define a class with a bunch of empty methods, and it
would be usable as an abstract class.
>> The former is an example of someone writing a function whose first
>> parameter is expected to be any object that is derived from
>> MutableContainer (including dict), or is derived from a class that
>> implements MutableContainer (including those implementing dict), or is
>> derived from a class that specifically implements MutableContainer.add
>> using a declaration like:
>> class CanAdd:
>> implements MutableContainer.add
>> def add(self, key, value):
> I find you're making the whole "implements" procedure, a little too
Ouch. Touché. :(
Simple things simple. Complex things possible.
More information about the Python-3000