mirror of
https://github.com/element-hq/synapse
synced 2024-08-21 09:00:21 +00:00
Add a comment about the zip(*[zip(sorted(...),...)])
This commit is contained in:
parent
bdcd7693c8
commit
9951542393
1 changed files with 8 additions and 0 deletions
|
@ -453,6 +453,14 @@ class SQLBaseStore(object):
|
||||||
if not values:
|
if not values:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# This is a *slight* abomination to get a list of tuples of key names
|
||||||
|
# and a list of tuples of value names.
|
||||||
|
#
|
||||||
|
# i.e. [{"a": 1, "b": 2}, {"c": 3, "d": 4}]
|
||||||
|
# => [("a", "b",), ("c", "d",)] and [(1, 2,), (3, 4,)]
|
||||||
|
#
|
||||||
|
# The sort is to ensure that we don't rely on dictionary iteration
|
||||||
|
# order.
|
||||||
keys, vals = zip(*[
|
keys, vals = zip(*[
|
||||||
zip(
|
zip(
|
||||||
*(sorted(i.items(), key=lambda kv: kv[0]))
|
*(sorted(i.items(), key=lambda kv: kv[0]))
|
||||||
|
|
Loading…
Reference in a new issue