#34603: ~Q() incorrectly interpreted as full rather than empty
-------------------------------------+-------------------------------------
     Reporter:  Anders Kaseorg       |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  4.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  wontfix
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Anders Kaseorg):

 There’s an important difference between ''including'' nothing and
 ''excluding'' nothing. We can’t just say these are the same because they
 both involve “nothing”.

 - `Q()` matches every row that satisfies no particular restrictions—i.e.,
 it matches every row. (In Python, `all([]) == True`.)
 - `~Q()` should match everything ''other than'' the rows that satisfy no
 particular restrictions–i.e., it should match no rows. (In Python,
 `not(all([])) == False`.)

 I know this is a dense explanation that’s hard to digest in this abstract
 form. But the rules of formal logic do give us a right answer here; this
 is not some ambiguous question of philosophy.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34603#comment:4>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701886c247eca-c3d892dd-7f0a-4b3c-96fa-855c3c9466c7-000000%40eu-central-1.amazonses.com.

Reply via email to