#32662: Refactor a generator out from part of SQLCompiler.get_order_by()
------------------------------------------------+------------------------
               Reporter:  Chris Jerdonek        |          Owner:  nobody
                   Type:  Cleanup/optimization  |         Status:  new
              Component:  Uncategorized         |        Version:  dev
               Severity:  Normal                |       Keywords:
           Triage Stage:  Unreviewed            |      Has patch:  0
    Needs documentation:  0                     |    Needs tests:  0
Patch needs improvement:  0                     |  Easy pickings:  0
                  UI/UX:  0                     |
------------------------------------------------+------------------------
 I noticed that `SQLCompiler.get_order_by()` has a 70-line
 
[https://github.com/django/django/blob/aa4acc164d1247c0de515c959f7b09648b57dc42/django/db/models/sql/compiler.py#L297-L368
 chunk of code] whose job is to build up an `order_by` list, which is then
 iterated over
 
[https://github.com/django/django/blob/aa4acc164d1247c0de515c959f7b09648b57dc42/django/db/models/sql/compiler.py#L372
 right after]. That chunk of code has 8 `order_by.append()` lines. It looks
 like this could be made cleaner by pulling those lines out into a private
 method that is instead a generator that yields those pairs. That would
 eliminate the need for having `order_by.append()` in several spots, and it
 would reduce the size of the method into two smaller methods.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32662>
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 on the web visit 
https://groups.google.com/d/msgid/django-updates/052.1bc2332af9129e8a1aa071fbc5ce1d18%40djangoproject.com.

Reply via email to