"Kim Branson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi i'm interested in implementing a factoryclass in python > > What i'd like to do is have my factoryClass produce an instance of a > class with some methods defined in arguments to the factory class. > > The classes that are produced have many common methods, but a single > unique method. This method actually is a series of calls to a c++ > api.
It sounds like you could create the basic class as normal but pass in the appropriate function to the init constructor. Then instead of making it a method create a metjod that calls that function, something like this: class C: def __init__(self, myfunc): self.func = myfunc def driver(self,params_as_needed): return self.func(params_as_needed) def common1(self....) etc... Now you can create instances like: def f1(....):... def f2(...).... c = C(f1) d = C(f2) etc. Is that what you want? Alan G. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor