Re: Adding method from one class to another class or to instance of another class

2009-07-27 Thread marekw2143
Thanks for your responses. im_func is all I need. I considered subclassing, wchih is more easy to extend, but I needed some quick way to add a method to another class. Regards, Marek -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding method from one class to another class or to instance of another class

2009-07-24 Thread Terry Reedy
marekw2143 wrote: Hi, I have one class (A) that has defined method createVars. I would like to add that method to class B The code looks like this: class A(object): def createVars(self): self.v1 = 1 self.v2 = 3 pass class B(object): pass I don't want to use inheritan

Re: Adding method from one class to another class or to instance of another class

2009-07-24 Thread Peter Otten
marekw2143 wrote: > Hi, > > I have one class (A) that has defined method createVars. I would like > to add that method to class B > The code looks like this: > > > class A(object): >def createVars(self): > self.v1 = 1 > self.v2 = 3 > pass > > class B(object): >pass >

Adding method from one class to another class or to instance of another class

2009-07-24 Thread marekw2143
Hi, I have one class (A) that has defined method createVars. I would like to add that method to class B The code looks like this: class A(object): def createVars(self): self.v1 = 1 self.v2 = 3 pass class B(object): pass I don't want to use inheritance (because class A