#35893: Using list comprehension (instead of a generator) to any/all where the
items are side-effect free is a performance error
-------------------------------------+-------------------------------------
               Reporter:  john-      |          Owner:  john-parton
  parton                             |
                   Type:             |         Status:  assigned
  Cleanup/optimization               |
              Component:             |        Version:  dev
  contrib.admin                      |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  1
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 When passing a generator to `any()` or `all()`, Python can perform short-
 circuit evaluation to avoid needless computation.

 Directly passing a list using list-comprehension is generally not
 recommended, unless the list-comprehension has a side-effect (for example
 calling a method that sets attributes on an object)

 There's at least one place in the code-base where it's safe to replace
 list comprehension with a generator and get the short-circuit optimization
 for "free."
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35893>
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/0107019302aecb46-5b98eeeb-3ae0-4a0b-972d-65be48709855-000000%40eu-central-1.amazonses.com.

Reply via email to