#31561: QuerySet could be a collections.abc.Set
-------------------------------------+-------------------------------------
Reporter: yahya- | Owner: nobody
abou-imran |
Type: | Status: new
Cleanup/optimization |
Component: Database | Version: 3.0
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 don’t know if it’s intended, but `QuerySet` doesn’t inherit from
`collections.abc.Set` although it implements its full API.
The only missing methods is `__contains__` but the `in` is working anyway,
fall-backing to the iteration protocol (through `__iter__`).
Pass it to the `Set.register` could also be considered.
I’m not sure if there is a clear win to this, or if it could include some
non desired behaviors (like the possibility of unions with other `Set`
types).
From a theoretical point of view it’s seems pretty logic – it’s called
“Query**Set**” by the way! –, however since `practicality beats purity`…
--
Ticket URL: <https://code.djangoproject.com/ticket/31561>
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/059.fd4c2ede100bc112a78d06870b98e368%40djangoproject.com.