Re: replace the base class

2007-05-31 Thread aspineux
Larry: Using "as", I cannot use both Circle and ColorCircle or more like 3DCircle ... at the same time, only one of them. But this is a easy solution in some cases. On 31 mai, 00:25, Matimus <[EMAIL PROTECTED]> wrote: Hi Martimus, your idea was a good one, I used it to meet my _particular_ need

Re: replace the base class

2007-05-30 Thread Matimus
This is a rather simplistic example, but you may be able to use a mixin class to achieve what you need. The idea is that you write a class that overrides only what is needed to add the new functionality. For you it would be Color. [code] class Graph(object): def _foo(self): print "Grap

Re: replace the base class

2007-05-30 Thread Larry Bates
aspineux wrote: > Hi > > I would like a kind of function able to replace the base class like > that: > > class Graph: > pass > > class Circle(Graph): > pass > > class Square(Graph): > pass > > class ColorGraph: > pass > >

replace the base class

2007-05-30 Thread aspineux
Hi I would like a kind of function able to replace the base class like that: class Graph: pass class Circle(Graph): pass class Square(Graph): pass class ColorGraph: pass def Adopt(new_base_class, child_class, old_base_class): return newclass ColorCircle=Adopt