On 2/12/07, Benjamin Slavin <[EMAIL PROTECTED]> wrote: > > On 2/11/07, Honza Kr�l <[EMAIL PROTECTED]> wrote: > > > > is this really necessary ? since you always subclass formsForm, why > > wouldn't you use: > > class PasswordChangeForm(forms.Form): > > def __init__( self, user, *args, **kwargs ): > > super(PasswordChangeForm, self ).__init__( *args, **kwargs) > > self.user = user > > Actually, your suggestion was my original approach. > > The primary benefit of your suggestion is that it ensures that the > arguments are passed (not as much checking is required in the form). > > > I agree that its a little bit more typing, but its also more generic > > and doesn't add functionality that will be left unused in 9 uses out > > of ten. > > I agree with your evaluation that it won't be used in 9 out of 10 > cases... but that still means a usage rate of 10%. I do feel that > this is a common usage pattern. > > The reason that I make the suggestion is that I found myself using > this functionality (overriding __init__) in a number of places (clear > violation of DRY). Aside from the DRY aspect, I don't like the idea of > asking newbies to override __init__ for a common case.
I am mortified when thinking about people that cannot override __init__ in a blink of an eye doing actual programming. ;) (look where it got PHP ;) ) > Also, this functionality has very low overhead... the diff for my > current implementation (without tests or docs) is two lines. true, but what would happen if you added two lines (or worse - an extra argument to a generic function/method) for everything that 10% of people would use and is easily (even though maybe little clumsily) done without it? Certainly nothing I would want to use (subjectively). I personally love the fact, that Django is simple, no feature bloat, everything is as simple as possible while maintaining 100% usability. It's just my personal opinion, but from the look of the code its shared among others as well. > > - Ben > > > > -- Honza Kr�l E-Mail: [EMAIL PROTECTED] ICQ#: 107471613 Phone: +420 606 678585 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---