Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Marko Rauhamaa Newsgroups: comp.lang.python Subject: Re: Classic OOP in Python Date: Thu, 18 Jun 2015 14:25:26 +0300 Organization: A noiseless patient Spider Lines: 29 Message-ID: <87oakdz2ah.fsf@elektro.pacujo.net> References: <23b2fae3-91d5-486b-9898-78b34bee486f@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="b7cb1518d23ec19d482dcc9c31d30fdd"; logging-data="14310"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/oAIbeL6QbHHkxYNycsgQ0" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:zoZT8BGO3CLCSMhcCTlOZeZUdIA= sha1:E+PHGL7FsD5W4CKB82nbPc9l9Pk= Xref: csiph.com comp.lang.python:92821 Todd : > On Thu, Jun 18, 2015 at 1:03 PM, Fabien wrote: >> 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) >> >> > I think this is what abstract base classes are for in Python. And they can be ok as long as you're not making them into a habit. Marko