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

Reply via email to