On Feb 13, 11:14 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> There's a bunch of code in ModelForms.__new__ that tries to protect
> people from themselves for what looks like a real edge case.
>
> In normal Python code, if you have a class that subclasses from multiple
> parents and you try to access an attribute on a parent, Python just
> picks the first occurrence as it walks through the MRO (method
> resolution order) list.
>
> In ModelForms, if you specify the Meta inner class on multiple parents
> (and not on the child class), we walk through all the parents in __new__
> to check that each Meta is consistent. But we still only use the one of
> them (fortunately). All this extra walking and error checking leads to a
> bunch of extra code that isn't totally trivial. I'd like to remove it
> (it's a dozen lines of code that keeps finding its way into problem
> reports).
>
> If people specify multiple Meta classes on parents, we're only going to
> use the first one -- just like Python always does. If they want to
> adjust the parent's Meta class, they can subclass in their child class,
> just like Python always allows and encourages. We don't appear to be
> trying to do anything funky by taking pieces out of the parent's Meta
> when Meta is specified in the child and doesn't subclass the parent's
> Meta. So this isn't removing functionality. It's just removing a
> paranoia check that would only be triggered if you suddenly expected
> Python to behave differently than it normally did. (Plus the number of
> people doing multiple inheritance there is likely to be tiny. The only
> real utility is for mix-in adding of methods.)
>
> Any strong objections to not behaving like Python here?

+1 I'm all for changes that make things consistent with the behavior
of python.

>
> Malcolm
>
> --
> Depression is merely anger without 
> enthusiasm.http://www.pointy-stick.com/blog/
--~--~---------~--~----~------------~-------~--~----~
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