From dca1764e76bff0bebd616d4f369cb20866d6c92c Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Wed, 23 Jul 2008 12:13:16 +0000 Subject: [PATCH] Simplify rapi.baserlib.MapFields() We can use zip for simplifying this function. Actually, at this point I'm not sure if it needs to be a separate function at all. Reviewed-by: imsnah --- lib/rapi/baserlib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rapi/baserlib.py b/lib/rapi/baserlib.py index ee2e9b233..099fab1e2 100644 --- a/lib/rapi/baserlib.py +++ b/lib/rapi/baserlib.py @@ -37,7 +37,7 @@ def BuildUriList(ids, uri_format, uri_fields=("name", "uri")): """ (field_id, field_uri) = uri_fields - + def _MapId(m_id): return { field_id: m_id, field_uri: uri_format % m_id, } @@ -73,7 +73,7 @@ def MapFields(names, data): """ if len(names) != len(data): raise AttributeError("Names and data must have the same length") - return dict([(names[i], data[i]) for i in range(len(names))]) + return dict(zip(names, data)) def _Tags_GET(kind, name=None): -- GitLab