Replace Whole Object Through Object Method

digitalorganics at gmail.com digitalorganics at gmail.com
Mon Jun 26 23:29:32 EDT 2006


Bruno Desthuilliers wrote:
(snip)
> >
> > It is very important that both should maintain attribute values,
> > regardless of whether they take on new "roles".
>
> Seems obvious. But just a question, BTW: do workers and employers share
> the same attributes ? And if not, how do you intend to initialize the
> employers attributes on workers (and the other way round) ?

They have unique attributes, conflict is not a problem. What do you
mean by init-on?

>
> > Furthermore, this is a
> > very simple case and ultimately in my program an object
>
> *Any* object ?-) Yes, any real-world object modeled in my program.
>
> > should be able
> > to dynamically take on a multitude of roles (classes of behavior)
>  > without mucking at all with their pre-existing states.
>
> Multiple roles at the same time, or sequentially ? And in the first case
> (which I assume), do you have the case of overriding behaviors ? And if
> yes, how should the resolution order be defined ? And what about
> attributes ? (I mean, do your 'roles' have specific attributes ?)

Multiple roles at the same time, with specific attributes for each.
Overriding behaviors is not a problem as each has unique behaviors.
Common behaviors are sourced from a base class. In the case of multiple
simultaneous roles, overwriting these common behaviors with duplicates
isn't really a problem in the sense that the dups are indeed identical
to the previous code.




More information about the Python-list mailing list