django/django — pull request #480 by mattrobenolt (2012-10-30 22:06:58+00:00)
Title: Optimize QuerySet.__contains__ by doing an exists()

To go alone with the assumption that `QuerySet`s being lazy, it makes
sense to me that when checking "in" an unevaluated `QuerySet`, we
should translate that lookup to an `exists()` call to prevent pulling
the whole dataset.

Is there a reason that this behavior is the way it is today? I don't know if I'm missing some specific reason to make "in" grab the whole data set and us force people to know to use `exists()` instead. It seems a bit counter intuitive and goes against the idea of everything being lazy.