Re: Using an existing instance as parent

2008-09-01 Thread Bruno Desthuilliers
André a écrit : Hi, I was trying to find a way to set, upon __init__() the parent of a class to an existing instance. ??? Sorry but I just can't make any sense of this. Here is a minimal example of what I'm trying to do: class A(object): def __init__(self, x): self.x = x class B(A):

Using an existing instance as parent

2008-09-01 Thread André
Hi, I was trying to find a way to set, upon __init__() the parent of a class to an existing instance. Here is a minimal example of what I'm trying to do: class A(object): def __init__(self, x): self.x = x class B(A): def __init__(self, *args): if not isinstance(args[0], A): supe