Am I missing something with Python not having interfaces?

Max M maxm at mxm.dk
Tue May 6 16:06:23 EDT 2008


Arnaud Delobelle skrev:
> jmDesktop <needin4mation at gmail.com> writes:
> 
>> 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.
> 
> You're not missing anything.  An Interface is the Poor Man's Multiple
> Inheritance.  But in truth, even without multiple inheritance, Python
> wouldn't need java-like interfaces.


Interfaces are a great concept for many things, and they can cover a few 
soft spots in Python.

There is the possibility of using the great zope.interface library 
http://pypi.python.org/pypi/zope.interface. Just use:

"easy_install zope.interface"

And you have interfaces.



-- 

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science




More information about the Python-list mailing list