On Feb 3, 10:24 am, Peter Otten <__pete...@web.de> wrote:
> Marc Aymerich wrote:
> > On Feb 2, 12:11 am, Peter Otten <__pete...@web.de> wrote:
> >> Marc Aymerich wrote:
> > Hi!,
> > Unfortunately per_class attribute losses the "independence" when I try
> > to mix it with django models.Model .
>
> >
Marc Aymerich wrote:
> On Feb 2, 12:11 am, Peter Otten <__pete...@web.de> wrote:
>> Marc Aymerich wrote:
> Hi!,
> Unfortunately per_class attribute losses the "independence" when I try
> to mix it with django models.Model .
>
> from django.db import models
> class Plugin(models.base.ModelBase):
On Feb 2, 5:58 pm, Michele Simionato
wrote:
> Notice that Peter's approach also works without inheritance:
>
> registries = {}
>
> @property
> def per_class(self):
> cls = type(self)
> try:
> return registries[cls]
> except KeyError:
> result = registries[cls] = []
> ret
Notice that Peter's approach also works without inheritance:
registries = {}
@property
def per_class(self):
cls = type(self)
try:
return registries[cls]
except KeyError:
result = registries[cls] = []
return result
class A(object): per_class=per_class
class B(object): p
On Feb 2, 12:18 pm, Peter Otten <__pete...@web.de> wrote:
> Marc Aymerich wrote:
> > On Feb 2, 12:11 am, Peter Otten <__pete...@web.de> wrote:
> >> Marc Aymerich wrote:
> >> > Hi all,
> >> > I want to provide an encapsulated static attribute called _registry
> >> > for several classes.
>
> >> > I t
On Feb 2, 12:11 am, Peter Otten <__pete...@web.de> wrote:
> Marc Aymerich wrote:
> > Hi all,
> > I want to provide an encapsulated static attribute called _registry
> > for several classes.
>
> > I try to use inheritance in order to make it DRY: all classes inherit
> > from a BaseClass that impleme
Marc Aymerich wrote:
> On Feb 2, 12:11 am, Peter Otten <__pete...@web.de> wrote:
>> Marc Aymerich wrote:
>> > Hi all,
>> > I want to provide an encapsulated static attribute called _registry
>> > for several classes.
>>
>> > I try to use inheritance in order to make it DRY: all classes inherit
>>
On Feb 2, 12:11 am, Peter Otten <__pete...@web.de> wrote:
> Marc Aymerich wrote:
> > Hi all,
> > I want to provide an encapsulated static attribute called _registry
> > for several classes.
>
> > I try to use inheritance in order to make it DRY: all classes inherit
> > from a BaseClass that impleme
Marc Aymerich wrote:
> Hi all,
> I want to provide an encapsulated static attribute called _registry
> for several classes.
>
> I try to use inheritance in order to make it DRY: all classes inherit
> from a BaseClass that implements the _registry encapsulation. But with
> inheritance it doesn't w
Hi all,
I want to provide an encapsulated static attribute called _registry
for several classes.
I try to use inheritance in order to make it DRY: all classes inherit
from a BaseClass that implements the _registry encapsulation. But with
inheritance it doesn't work how I want, because a single ins
10 matches
Mail list logo