diff options
author | Erik Johnston <erik@matrix.org> | 2015-05-05 17:06:55 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-05-05 17:06:55 +0100 |
commit | 995154239358af589146ab4697e7cb4f100e2d84 (patch) | |
tree | fc6902561479519e1ce3e54d97f7d42544d20da7 /synapse/storage/_base.py | |
parent | Fix indentation (diff) | |
download | synapse-995154239358af589146ab4697e7cb4f100e2d84.tar.xz |
Add a comment about the zip(*[zip(sorted(...),...)])
Diffstat (limited to 'synapse/storage/_base.py')
-rw-r--r-- | synapse/storage/_base.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py index b7c3cf03c8..94946587f5 100644 --- a/synapse/storage/_base.py +++ b/synapse/storage/_base.py @@ -453,6 +453,14 @@ class SQLBaseStore(object): if not values: 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(*[ zip( *(sorted(i.items(), key=lambda kv: kv[0])) |