#30179: Merging 3 or more media objects can throw unnecessary
MediaOrderConflictWarnings
-------------------------------+------------------------------------
Reporter: Matt Westcott | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Comment (by Johannes Hoppe):
Matt, great work. I believe it is best to merge all lists at once and not
sequentially as I did. Based on your work, I would suggest to simply use
the algorithms implemented in Python. Therefore the whole merge function
can be replaced with a simple one liner:
{{{
import heapq
from collections import OrderedDict
def merge(*sublists):
return list(OrderedDict.fromkeys(heapq.merge(*sublists)))
# >>> merge([3],[1],[1,2],[2,3])
# [1, 2, 3]
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30179#comment:15>
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/064.f07391c0c0a0cd0dbb418667999fcdb0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.