#23919: Cleanups for when we drop Python 2 compatibility
--------------------------------------+------------------------------------
     Reporter:  Tim Graham            |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  new
    Component:  Core (Other)          |                  Version:
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------

Comment (by Josh Smeaton):

 I had an attempt at dropping the creation_counter for model fields, but I
 *think* it might be more costly than the current method, considering so
 many things rely on the order being consistent. My attempt was here, with
 associated discussion I'll copy some of below:
 https://github.com/django/django/pull/7983

 > I'm not sure this is worth continuing with, at least not in the same
 way. Too many systems rely on the fields being ordered, which isn't going
 to be possible without maintaining another list of fields such as
 definition_order = []. This can be done for local fields, but then
 proxy/parent fields will need to be returned in the same definition order.
 This might be something like:

 {{{
 parent_fields + [field for field in self.definition_order if field in
 local_fields]
 }}}

 > Then we'd need to account for private and hidden fields. But what's the
 point? We'd now be storing a separate list of all field references for
 each model, rather than a counter (int) on each field, and reordering
 fields in _get_fields() whether or not they need to be ordered. Of course
 I'd be happy to see a better solution that worked, I'm just giving up on
 this particular method for the moment.

--
Ticket URL: <https://code.djangoproject.com/ticket/23919#comment:95>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.0f7fbe633f26c93287d58e37fbd4d2e3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to