On Tue, Feb 1, 2011 at 10:22 PM, bruno desthuilliers <bruno.desthuilli...@gmail.com> wrote: > On 1 fév, 22:05, Marc Aymerich <glicer...@gmail.com> 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 work how I want, because a single instance of >> the _registry is shared between all of the inherited classes, and I >> want to have an independent _registry for every class. >> >> How can I do that without coping all the code in every class? > > > What was your Django question exactly ?-) > > Sorry but this is pure Python stuff, nothing Django-related here. > You'd be better posting this on comp.lang.python.
yes, the question is a bit off-topic, but everyone here uses python :) > (hint: one possible answer is 'metaclass') thanks, I'll check how can I take advantage of metaclasses for my problem. -- Marc -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.