Am I missing something with Python not having interfaces?

Jim Washington jwashin at vt.edu
Tue May 6 11:05:16 EDT 2008


jmDesktop wrote:
> Studying OOP and noticed that Python does not have Interfaces.  Is
> that correct?  Is my schooling for nought on these OOP concepts if I
> use Python.  Am I losing something if I don't use the "typical" oop
> constructs found in other languages (Java, C# come to mind.)  I'm
> afraid that if I never use them I'll lose them and when I need them
> for something beside Python, I'll be lost.  Thank you.
> --
> http://mail.python.org/mailman/listinfo/python-list

Others have commented that interfaces are not normally important in Python.

However, if you want to do something *with* interfaces like declaring
that an object or class implements a particular interface, or querying
the interfaces implemented by an object, you might look at
zope.interface.  Although it is used by and created for Zope,
zope.interface is packaged to be installable and usable outside of zope.
 It's available at the Cheese Shop.

If you want to do adaptation from one interface to another or, for
example, register and look-up utilities by interface, zope.component is
also handy.

- Jim Washington



More information about the Python-list mailing list