On Thu, 2008-07-03 at 14:56 +0200, Christian Tanzer wrote: [...] > I'd propose to write that check as > > parents = [b for b in bases if isinstance(b, ModelBase)] > if parents: > return super(ModelBase, cls).__new__ (cls, name, bases, attrs) > ... > > Simpler, and it allows several independent `Model` classes using the > same metaclass, if that's ever necessary.
We need the parents list to be properly constructed later in the function, so the current code saves having to do a second iteration. It's nice that we can also use the "parents" list to do the early bailout. I don't see the significant use-case for the "several independent Model classes". We introduce something like that and we have to support it forever and somebody might actually use it, even though it's a bit insane. The only real reason it's worth having an separate metaclass like we do now (i.e. the reason it's not just a __new__ method on Model) is so that all this construction happens at import time, rather than instance creation time. Allowing the metaclass to be reused isn't a goal. So thanks, but no thanks. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---