Re: How to replace a method in an instance.

2007-08-27 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : On Aug 22, 12:48 am, Bruno Desthuilliers [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] a écrit : (snip) Of course, a function in a class is also know as a method. Less obvious but still wrong !-) I wish the authors of the Python books would get a clue then.

Re: How to replace a method in an instance.

2007-08-27 Thread Alex Martelli
Bruno Desthuilliers [EMAIL PROTECTED] wrote: Of course, a function in a class is also know as a method. Less obvious but still wrong !-) I wish the authors of the Python books would get a clue then. I'd think that at least some authors of some Python books would explain all this

How to replace a method in an instance.

2007-08-24 Thread Steven W. Orr
In the program below, I want this instance to end up calling repmeth whenever inst.m1 is called. As it is now, I get this error: Hello from init inst = __main__.CC instance at 0x402105ec Traceback (most recent call last): File ./foo9.py, line 17, in ? inst.m1() TypeError: repmeth()

Re: How to replace a method in an instance.

2007-08-24 Thread kyosohma
On Aug 24, 11:02 am, Steven W. Orr [EMAIL PROTECTED] wrote: In the program below, I want this instance to end up calling repmeth whenever inst.m1 is called. As it is now, I get this error: Hello from init inst = __main__.CC instance at 0x402105ec Traceback (most recent call last): File

Re: How to replace a method in an instance.

2007-08-24 Thread Steven W. Orr
On Friday, Aug 24th 2007 at 09:12 -0700, quoth [EMAIL PROTECTED]: =On Aug 24, 11:02 am, Steven W. Orr [EMAIL PROTECTED] wrote: = In the program below, I want this instance to end up calling repmeth = whenever inst.m1 is called. As it is now, I get this error: = = Hello from init = inst =

Re: How to replace a method in an instance.

2007-08-24 Thread Wildemar Wildenburger
Steven W. Orr wrote: Sorry. I need repmeth to have self passed to it automatically if it's called. I didn't mean to obfuscate the problem by not making a reference to self in repmeth. Am I being clear? Sort of. Maybe you fare better if you state what you want to achieve, instead of

Re: How to replace a method in an instance.

2007-08-24 Thread James Stroud
Steven W. Orr wrote: On Friday, Aug 24th 2007 at 09:12 -0700, quoth [EMAIL PROTECTED]: =On Aug 24, 11:02 am, Steven W. Orr [EMAIL PROTECTED] wrote: = In the program below, I want this instance to end up calling repmeth = whenever inst.m1 is called. As it is now, I get this error: = = Hello

Re: How to replace a method in an instance.

2007-08-24 Thread Steven W. Orr
On Friday, Aug 24th 2007 at 12:26 -0400, quoth Steven W. Orr: =On Friday, Aug 24th 2007 at 09:12 -0700, quoth [EMAIL PROTECTED]: = ==On Aug 24, 11:02 am, Steven W. Orr [EMAIL PROTECTED] wrote: == In the program below, I want this instance to end up calling repmeth == whenever inst.m1 is called.

Re: How to replace a method in an instance.

2007-08-24 Thread James Stroud
Steven W. Orr wrote: Ok. I have a collection of classes that are produced by a factory. They all inherit from a baseclass. One (maybe more) of the classes inherits a method that he shouldn't. All I want is to be able to change that particular class so that he will have the special method

Re: How to replace a method in an instance.

2007-08-24 Thread Bruno Desthuilliers
Steven W. Orr a écrit : In the program below, I want this instance to end up calling repmeth whenever inst.m1 is called. As it is now, I get this error: Hello from init inst = __main__.CC instance at 0x402105ec Traceback (most recent call last): File ./foo9.py, line 17, in ?

Re: How to replace a method in an instance.

2007-08-24 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : On Aug 24, 11:02 am, Steven W. Orr [EMAIL PROTECTED] wrote: In the program below, I want this instance to end up calling repmeth whenever inst.m1 is called. As it is now, I get this error: Hello from init inst = __main__.CC instance at 0x402105ec Traceback (most

Re: How to replace a method in an instance.

2007-08-24 Thread J. Cliff Dyer
Steven W. Orr wrote: On Friday, Aug 24th 2007 at 12:26 -0400, quoth Steven W. Orr: =On Friday, Aug 24th 2007 at 09:12 -0700, quoth [EMAIL PROTECTED]: = ==On Aug 24, 11:02 am, Steven W. Orr [EMAIL PROTECTED] wrote: == In the program below, I want this instance to end up calling repmeth ==

Re: How to replace a method in an instance.

2007-08-24 Thread kyosohma
On Aug 22, 12:48 am, Bruno Desthuilliers [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] a écrit : On Aug 24, 11:02 am, Steven W. Orr [EMAIL PROTECTED] wrote: In the program below, I want this instance to end up calling repmeth whenever inst.m1 is called. As it is now, I get this error:

Re: How to replace a method in an instance.

2007-08-24 Thread James Stroud
[EMAIL PROTECTED] wrote: I'm not going to help with these class / instance / whatever any more and leave it to all you professionals. Wrong again. Stick your neck out, look like an ass, and then learn--alot. That's what I do. Your misinformation will be corrected, even if you are chastised in