My 2 cents, I think @johan's suggestion makes sense.

if obj in queryset:

It's very pythonic. it should do what __len__ does and cache it, if you 
want the single quick db query you can always use exists().


ps @roger

>>> timeit.timeit('m.GL.objects.filter(pk=x.pk)', setup='import 
myapp.models as m;x = m.GL.objects.all()[324]', number=100)
0.05818330496549606

is not doing anything, add a `.exists()` or `len(..)` or something to evaluate 
the queryset. That number is WAY too low.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/5195eb58-8600-43a3-ad46-1c72f691f04b%40googlegroups.com.

Reply via email to