#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 Matthias Kestenholz):

 It's not that easy to write library code which supports both code paths. I
 "complained" to Loïc at DutH 2015 (or something) about the `get_query_set`
 -> `get_queryset` rename. That one was really hard for third party app
 maintainers to work around and support all possible combinations given
 that people are supposed to use subclassing to customize behaviors.

 This seems to be a similar case. It's nice that Python now supports
 calling this method and that we could in principle use it for our own
 purposes, but the explicitness of `contribute_to_class` might still have
 some value. Especially given the fact that the change doesn't allow us to
 remove a lot of code in the future, and given that it replaces an explicit
 mechanism with a more implicit mechanism where people have to know more of
 Python's internals to do what they want.

 Also, you write that `contribute_to_class` is private API. It *is*
 mentioned in the `docs/` folder of the Django repository so I'm not sure I
 agree with that.

 I'm quite sure the potential downsides of this change, especially the
 impact to third party app developers are bigger than the upsides of using
 new standard Python API.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/27880#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 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/010701946bad772a-71370ead-122c-424a-8122-924645cee870-000000%40eu-central-1.amazonses.com.

Reply via email to