Re: class factory example needed (long)

2005-03-03 Thread Gary Ruben
Thanks Steven and Kent, both of your suggestions look good to me. I'll try both out and pick one. Gary Gary Ruben wrote: OK, I've managed to get this to work with Rainer's method, but I realised it is not the best way to do it, since the methods are being added by the constructor, i.e. they are

Re: class factory example needed (long)

2005-03-01 Thread Kent Johnson
Gary Ruben wrote: OK, I've managed to get this to work with Rainer's method, but I realised it is not the best way to do it, since the methods are being added by the constructor, i.e. they are instance methods. This means that every time a foo object is created, a whole lot of code is being run

Re: class factory example needed (long)

2005-03-01 Thread Steven Bethard
Gary Ruben wrote: OK, I've managed to get this to work with Rainer's method, but I realised it is not the best way to do it, since the methods are being added by the constructor, i.e. they are instance methods. This means that every time a foo object is created, a whole lot of code is being run

Re: class factory example needed (long)

2005-03-01 Thread Gary Ruben
OK, I've managed to get this to work with Rainer's method, but I realised it is not the best way to do it, since the methods are being added by the constructor, i.e. they are instance methods. This means that every time a foo object is created, a whole lot of code is being run. It would be bett

Re: class factory example needed (long)

2005-02-28 Thread Gary Ruben
Thanks for the very helpful reply Rainer, I thought I couldn't use setattr because I need the syntactic sugar sqrt(f) to work, but with your example code Numeric.sqrt(f) does in fact work correctly. I also need to do a bit more than may be possible with a simple lambda function, but I should be

Re: class factory example needed (long)

2005-02-27 Thread Rainer Mansfeld
Gary Ruben wrote: I have a class factory problem. You could say that my main problem is that I don't understand class factories. My specific problem: I have a class with several methods I've defined. To this class I want to add a number of other class methods where the method names are taken from a

class factory example needed (long)

2005-02-26 Thread Gary Ruben
I have a class factory problem. You could say that my main problem is that I don't understand class factories. My specific problem: I have a class with several methods I've defined. To this class I want to add a number of other class methods where the method names are taken from a list. For each li