#32971: Internal Field.check() methods don't need to construct and return lists
-------------------------------------+-------------------------------------
Reporter: Chris | Owner: nobody
Jerdonek |
Type: | Status: new
Cleanup/optimization |
Component: Database | Version: dev
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I noticed that many of the internal "check()" methods used by `Field`
subclasses return lists (including the empty list) when they can just
yield items (or yield nothing). This is because the concrete `check()`
implementations unpack the return value when constructing a new list. See
here for one example of such a `check()` method:
https://github.com/django/django/blob/f331eba6d576752dd79c4b37c41d981daa537fe6/django/db/models/fields/__init__.py#L196-L205
The proposed change, then, would be to change methods like the following
to yield their items instead of creating and returning a list:
https://github.com/django/django/blob/f331eba6d576752dd79c4b37c41d981daa537fe6/django/db/models/fields/__init__.py#L243-L254
--
Ticket URL: <https://code.djangoproject.com/ticket/32971>
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.dff3df658ac5a07afe002a12b4ed4121%40djangoproject.com.