On May 6, 10:44 am, jmDesktop <[EMAIL PROTECTED]> 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.
Python supports interfaces. In the example below, "Vehicle" is an interface. class Vehicle: def drive(self, count): raise Exception("I'm only an interface... :-(") def number_of_wheels(self): return 0 def fly(self): pass class Car(Vehicle): def drive(self, count): print "The car walked %d steps" % count def number_of_wheels(self): return 4 As you can see, there are a couple of ways you can tell others "Vehicle" is an interface, like raising exceptions, returning useless values or doing nothing. You could also raise an exception in Vehicle.__init__. -- http://mail.python.org/mailman/listinfo/python-list