Thanks for your suggestion, Kent. I've looked into it a little bit and I think its probably the right way to go.
--- On Thu, 7/31/08, Kent Johnson <[EMAIL PROTECTED]> wrote: > From: Kent Johnson <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Mixing in and Mixing out classes in python > To: [EMAIL PROTECTED] > Cc: "Tutor Python" <tutor@python.org> > Date: Thursday, July 31, 2008, 5:29 PM > On Thu, Jul 31, 2008 at 8:09 PM, Tomaz Bevec > <[EMAIL PROTECTED]> wrote: > > Thanks for your reply Alan, > > > > I am partially asking out of interest, but I also have > a potential application. > > > > I'm working on a simulation of cellular growth > patterns (basically cell instances interacting > stochastically on a lattice). Anyway, there are many > different cell "behaviors" that I have to > simulate, and cells can potentially gain and lose these > "behaviors" over the course of the simulation. It > would be too much to put every behavior function in the cell > class, so I'm writing each behavior as a mixin and > mixing it in (and initializing it) when necessary or when > biological function is gained by the cells. > > Perhaps you could keep the behaviors in a dictionary? You > could > override __getattr__() in the cell class to look up > attributes whose > names start with 'behavior' in the dict. > > Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor