Mixin way?

2013-04-03 Thread andrea crotti
I have some classes that have shared behaviours, for example in our scenario an object can be visited, where something that is visitable would have some behaviour like --8---cut here---start-8--- class Visitable(Mixin): FIELDS = { 'visits': [],

Re: Mixin way?

2013-04-03 Thread Steven D'Aprano
On Wed, 03 Apr 2013 15:04:51 +0100, andrea crotti wrote: I have some classes that have shared behaviours, for example in our scenario an object can be visited, where something that is visitable would have some behaviour like [snip mixins] By the way, it's a common convention to name mixin

Re: Mixin way?

2013-04-03 Thread andrea crotti
2013/4/3 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info [snip] So, if you think of Visitable as a gadget that can be strapped onto your MyObj as a component, then composition is probably a better design. But if you think of Visitable as a mere collection of behaviour and state, then a

Re: Mixin way?

2013-04-03 Thread Neil Cerutti
On 2013-04-03, andrea crotti andrea.crott...@gmail.com wrote: Well I can explain better the situation to make it more clear. We are using CouchDb and so far it has been (sigh) a brutal manipulation of dictionaries everywhere, with code duplication and so on. Now I wanted to encapsulate all