[Tutor] Re: Python Class functionality idiosyncrasy..

amk at amk.ca amk at amk.ca
Wed Oct 22 07:40:10 EDT 2003


On Wed, Oct 22, 2003 at 04:36:18PM +0530, dhanvik at gmx.net wrote:
> Any program that would be implemented this way would be bad 
> programming and more than that bad designing of OO 
> structure for the prgram.

No, it's not necessarily bad style.  In fact it's fairly common to provide
an abstract base class that isn't usable on its own; the user is supposed to
subclass it and provide one method that implements some particular
behaviour.  A good example from the Python stdlib is the SocketServer
module, which is used like this:

from SocketServer import ForkingTCPServer

class NNTPServer (ForkingTCPServer):
    def handle (self):
        ... process request ...
	
--amk



More information about the Tutor mailing list