How about "pure virtual methods"?

Doug Holton insert at
Tue Dec 21 01:09:12 CET 2004

Doug Holton wrote:
>> Noam Raphael wrote:
>> even in the best solution that I know of,
>>> there's now way to check if a subclass has implemented all the 
>>> required methods without running it and testing if it works. 
> I think there are some solutions like PyProtocols, see section 2.2 on 
> this page:

Let me rephrase the rest of my answer.

This is something we could use in Python.  You should add a feature 
request to have this in Python 3.0, a.k.a. Python 3000:

You might have simple code such as:

inteface ICallable:
     def Call(args)

However, Python 3.0 is likely years away.  If you want to know how to 
run code like this and have real interfaces, abstract classes and 
virtual methods today, consult Fredrik Lundh.

More information about the Python-list mailing list