Re: Upgrading an instance to a subclass

2008-10-08 Thread Terry Reedy
Antoon Pardon wrote: I have a subclass of socket. class Mysocket (socket): ... But when I use the python library it will of course just return an instance of socket, like the SocketServer module. So now I was wondering if it is somehow possible to turn this instance into a Mysocket instance

Re: Upgrading an instance to a subclass

2008-10-08 Thread Orestis Markou
I would suggest rather than inheriting from socket, encapsulate over it: class MySocket(object): def __init__(self, socket): self.socket = socket Then you don't have to worry about patching instances... On Wed, Oct 8, 2008 at 12:54 PM, Antoon Pardon <[EMAIL PROTECTED]> wrote: > I have a

Upgrading an instance to a subclass

2008-10-08 Thread Antoon Pardon
I have a subclass of socket. class Mysocket (socket): ... But when I use the python library it will of course just return an instance of socket, like the SocketServer module. So now I was wondering if it is somehow possible to turn this instance into a Mysocket instance, either by somehow cha