On Tue, 2009-02-17 at 18:57 -0600, Jeremy Dunck wrote:
> On Tue, Feb 17, 2009 at 6:49 PM, Malcolm Tredinnick
> <[email protected]> wrote:
> ...
> > I'd be somewhat against this, I think. It's *very* easy to reuse
> > querysets and inadvertently cause extra database queries.
> ...
> > we're trading memory
> > usage for speed and ease of use (and providing a way to improve the
> > former in "expert mode").
>
> Point taken.
>
> I wish there were some way to issue a warning if _result_cache is
> filled but __iter__ isn't used more than once. :-/
Possible. Requires relying on __del__ being called so that we know when
it's not being used any longer. I prefer your other option, however.
> I could imagine a warning being issued if the functionality offered by
> .iterator is used more than once. That might be a happy medium-- then
> I could use .iterator as my default coding practice, and be slapped
> when I iterate more than once after all.
>
> if settings.DEBUG and self.prior_iteration:
> warnings.warn("dope!")
This certainly sounds reasonable and doable today without any real
overhead. Go ahead and make a patch/ticket.
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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---