#33441: Model Field.__hash__() should be immutable.
-------------------------------------+-------------------------------------
     Reporter:  Adam Johnson         |                    Owner:  Adam
                                     |  Johnson
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

 * status:  closed => new
 * resolution:  invalid =>
 * stage:  Unreviewed => Accepted


Comment:

 Replying to [comment:3 Adam Johnson]:
 > `__hash__` is never used for equality. The only requirement is that *IF*
 two objects are equal, they have the same hash. There's no problem with
 creating a `__hash__` that always does `return 1` - it will only make its
 use in dictionaries slow.
 >
 > Changing `__hash__` in the PR was unnecessary for the previous fix.

 Right, I missed it. I always find it suspicious when `__hash__()` does not
 match `__eq__()`, but it's probably just me 🤷, and we have a similar
 solution for `Model`.

 I'm also struggling with finding ''"plenty of uses"'', nevertheless it
 should not block this change .

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33441#comment:5>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.743af8d8d27e5837a5102a42ce66e479%40djangoproject.com.

Reply via email to