[Tutor] Re: Python Class functionality idiosyncrasy..

dhanvik at gmx.net dhanvik at gmx.net
Wed Oct 22 07:51:20 EDT 2003


Abstract classes have the abstract keyword preceeding then 
and hence it makes sense for  a reader of the program to 
know that the function would be implemented in the derived 
classes..but in this case theres no way of knowing whether 
the function was defined or not.. 
Hence, I was talking in terms of programming in Python.  :-)

 
On Wednesday 22 October 2003 05:10 pm, amk at amk.ca wrote:
> 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
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor




More information about the Tutor mailing list