Python "implements <interface>" equivalent?

David wizzardx at gmail.com
Fri Oct 5 07:57:41 EDT 2007


> I'm a seasoned Java programmer and quite a big fan of interfaces...
> i.e. The idea that if I make a number of distinct classes that
> implement interface X, I can pass them all as parameters to functions
> or whatnot that require an X object.
>
> Is there something similar in Python?
>

Python will probably be getting Abstract Base Classes at some point.

http://www.python.org/dev/peps/pep-3119/

For ABC in current versions of Python, see the "Can you implement
abstract classes in Python in 0 lines of code? Or 4?" question on this
page: http://norvig.com/python-iaq.html

David.



More information about the Python-list mailing list