#16211: using negated F()-expression in update query
-------------------------------------+-------------------------------------
     Reporter:  wdoekes              |                    Owner:  nobody
         Type:  New feature          |                   Status:  reopened
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |               Resolution:
     Severity:  Release blocker      |             Triage Stage:  Ready for
     Keywords:                       |  checkin
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by akaariai):

 The problem is that in 1.4 we already do define '&' and '|' to behave as
 bitwise operators. This is not documented, but the behaviour is there and
 tested. For this feature we need the same '&' and '|' operators to do
 boolean AND and OR operations in the DB. This is a conflict which I don't
 see any nice way to resolve. The best would be to have f1.bitand(f2) and
 f1.bitor(f2). But, if we do this we will be silently breaking existing
 code using the '&' and '|' operators.

 As for `__hash__` - from Python 3 docs:
 {{{
 Called by built-in function hash() and for operations on members of hashed
 collections
 including set, frozenset, and dict. __hash__() should return an integer.
 The only
 required property is that objects which compare equal have the same hash
 value...
 }}}

 The problem is all F-objects compare equal to each other by the `__eq__`
 override, and for that reason we can't implement `__hash__`.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16211#comment:25>
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 django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to