#27880: Use __set_name__ to replace some usages of contribute_to_class.
-------------------------------------+-------------------------------------
     Reporter:  Simon Charette       |                    Owner:  Clifford
         Type:                       |  Gama
  Cleanup/optimization               |                   Status:  assigned
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  python3.6            |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  1
  Needs tests:  1                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):

 Thanks for chiming in Matthias!

 I'll note that initial proposal of this ticket was not about
 replacing/deprecating `contribute_to_class` which would effectively be
 very disruptive to the ecosystem but to remove the `ModelBase.__new__`
 magic that performs explicit calls to `contribute_to_class` by having
 `__set_name__` call `contribute_to_class` instead.

 To me this ticket kind of go hand-in-hand with `__init_subclasses__`
 tickets #35827 and #34555 in the sense that it would be great to modernize
 the implementation of `ModelBase.__new__` in a way that takes advantage of
 these hooks while maintaining the developer facing interface and behavior.
 It's easier said than done though and not a well understood problem from a
 feasibility perspective.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/27880#comment:9>
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 visit 
https://groups.google.com/d/msgid/django-updates/010701946bb3da27-257c88a6-bdfc-44b5-ada7-87cd111be1c6-000000%40eu-central-1.amazonses.com.

Reply via email to