Does Python support interfaces?

hzhu at localhost.localdomain.bbs hzhu at localhost.localdomain.bbs
Mon Jul 17 21:50:02 EDT 2000


On Tue, 18 Jul 2000 01:08:03 GMT, Randall Parker <rgparker at west.net> wrote:
>I'm quite new to Python. For those who are familiar with Java interfaces:
>Does Python have a similar facility?
>
>Can one declare interfaces, then declare that a class implements some
>interface, instantiate an object of that class type, and then cast it to
>an interface that it is declared to support and then pass it around as a
>reference to that interface type and make calls to methods of that
>interface type?
>

Maybe someone has a better solution, but here's a little program that checks
which method is implemented in which class, of what type.  You can add more
bells and whistles in similar fashion (like the names of arguments)

http://x53.deja.com/getdoc.xp?AN=635109618

I can only track it in deja news.  It seems that the archive for Jun 1-15 is
missing from pipermail archive.

--
Huaiyu Zhu                       hzhu at users.sourceforge.net
Matrix for Python Project        http://MatPy.sourceforge.net



More information about the Python-list mailing list