#14655: formsets should be iterable
-------------------------------+--------------------------------------------
          Reporter:  kenth     |         Owner:  pandres
            Status:  reopened  |     Milestone:         
         Component:  Forms     |       Version:  SVN    
        Resolution:            |      Keywords:         
             Stage:  Accepted  |     Has_patch:  1      
        Needs_docs:  0         |   Needs_tests:  0      
Needs_better_patch:  0         |  
-------------------------------+--------------------------------------------
Comment (by ikelly):

 Instead of being a generator function, the {{{__iter__}}} method should
 simply return {{{iter(self.forms)}}}.  Why add a layer of wrapping when
 you can delegate?

 Why are the {{{__getitem__}}} and {{{__len__}}} methods necessary?  Since
 they require iterating over the full formset, they are less efficient than
 the {{{O(1)}}} methods on the underlying list, which bugs me.  Why not let
 them also delegate to {{{self.forms}}}, and anybody who needs to customize
 {{{__iter__}}} should just customize those as well?

-- 
Ticket URL: <http://code.djangoproject.com/ticket/14655#comment:7>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to