On Thu, 2008-07-03 at 15:38 +0200, Christian Tanzer wrote:
> 
> Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> 
> > 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.
> 
> But my proposal doesn't change that: for all classes `c`,
> `issubclass(c, P)` is equivalent to `isinstance(c, P.__class__)`.
> 
> You still have exactly the same result in `parents` as with the
> existing code -- the computation is just simpler and more general
> because no hardcoded class name is used anymore (and no NameError to
> deal with).

You are, of course, correct. Fixed in r7846. Thanks for the changes.

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to