Re: rpc.py

Sjoerd Mullender (Sjoerd.Mullender@cwi.nl)
Wed, 25 Aug 1993 23:53:30 +0200

On Wed, Aug 25 1993 Lance Ellinghouse wrote:

> I am working with the rpc.py module to create a set of server/client
> processes.. The problem I am having is that I wish to define a
> class that uses the Server and Client classes as:
>
> class MyServer(TCPServer, TCPClient):
> ......
>
> I can use any method in TCPServer, but I cannot use any methods in
> TCPClient. It does not seem to see the TCPClient at all..
> I DO NOT call the TCPClient.init() routine since I already call
> the TCPServer.init() call... Does this have something to do with it?

It seems to me that you are trying to live dangerously. I don't know
the rpc module, but I had a quick look, and it seems that both classes
use the same names for instance variables. This means that you really
have only one set of instance variables instead of one for both the
server and the client.

An alternative would be to not inherit from the two classes but to
create instance variables in your class that are instances of the two
classes you mention:

class MyServer:
def init(self,...):
self.server = TCPServer().init(...)
self.client = TCPClient().init(...)

Ordinarily, if you inherit from two super classes, you should call the
init() methods of both super classes.

Sjoerd Mullender
CWI, dept. CST, Kruislaan 413, 1098 SJ Amsterdam, Netherlands
email: Sjoerd.Mullender@cwi.nl fax: +31 20 592 4199
phone: +31 20 592 4127 telex: 12571 mactr nl