Malcolm Tredinnick schrieb: > Interestingly, looking at QuerySet.iterator() and QuerySet.__iter__, > they aren't synonyms. The point is that QuerySet.__iter__ iterates over > the result of QuerySet._get_data(), which actually sucks everything into > memory before iterating. On the other hand, QuerySet.iterator() is a > more memory-conscious thing, iterating over each row at a time, > returning it as it is retrieved. I'm not sure if this is just an > accidental implementation issue or something intentional, but it's going > to make me use iterator() a bit more explicitly in at least one case I > can think of. Hmm.. the things you learn when you take the time to read > the source...
It makes sense (after a while ;-) Usually, you want to build up a cache and not throw everything away. iterator() neither makes use of an existing cache nor stores the results. You don't want this to be the default behaviour. So, iterator() is for the case when you have to dig through large amounts of data and don't want any caching. iterator() isn't in the docs, shouldn't it be something about it? Michael --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---