#17186: Inverted F expression (negation)
-------------------------------------+-------------------------------------
     Reporter:  niwi                 |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  SVN
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:                       |      Needs documentation:  1
    Has patch:  1                    |  Patch needs improvement:  1
  Needs tests:  1                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by nate_b):

 Regarding use case for negation on non-boolean values: That's a good
 question; I'm not sure that there is one.  I provided that only as a
 stupid example of lack of composability (at the db level negation on non-
 boolean values can work, but that doesn't mean it is useful).  If you can
 propose a test, I would be glad to include it.  Altogether, though, that
 does raise a good question - so far, all {{{F()}}} objects are generally
 composable across all operations, and I would not want to break that by
 adding another operation.  Not all computations in general are composable,
 though; should {{{F()}}} object composability reflect that?  Now my head
 hurts.

 Regarding "Why ~F() instead of not F()": there are two reasons.  One: To
 match with [https://docs.djangoproject.com/en/dev/topics/db/queries
 /#complex-lookups-with-q-objects Q objects]; Two, and more importantly:
 python itself
 [http://docs.python.org/library/operator.html#operator.__not__ does not
 provide a __not__() method for object instances].  So yes, you are
 absolutely right, but I don't think it can be done.

 As to your other points, well taken.  I hope my updated patch is an
 improvement.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17186#comment:8>
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 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-updates?hl=en.

Reply via email to