On 06/17/2015 11:16 PM, [email protected] wrote:
You don't need interfaces with Python. Duck typing makes that all possible.
Yes, but I also like interfaces (or in python: mimicked interfaces with
NotImplementedError) for their clarity and documentation purposes.
Would you consider the following kind of program "unpythonic"?
class MovingObject(object):
"""Great doc about what a moving object is"""
def move(self):
"""Great doc about move"""
raise NotImplementedError()
class Dog(MovingObject):
def move(self):
print "Dog is moving"
class Car(MovingObject):
def move(self):
print "Car is moving"
(Disclaimer: I learned OOP with Java)
Fabien
--
https://mail.python.org/mailman/listinfo/python-list