[csw-devel] SF.net SVN: gar:[12094] csw/mgar/gar/v2/lib/python/opencsw.py
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Mon Dec 27 13:25:29 CET 2010
Revision: 12094
http://gar.svn.sourceforge.net/gar/?rev=12094&view=rev
Author: wahwah
Date: 2010-12-27 12:25:29 +0000 (Mon, 27 Dec 2010)
Log Message:
-----------
checkpkg: Using dict.setdefault in IndexDictBy
It's a more pythonic way of populating a dictionary.
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/opencsw.py
Modified: csw/mgar/gar/v2/lib/python/opencsw.py
===================================================================
--- csw/mgar/gar/v2/lib/python/opencsw.py 2010-12-27 12:25:04 UTC (rev 12093)
+++ csw/mgar/gar/v2/lib/python/opencsw.py 2010-12-27 12:25:29 UTC (rev 12094)
@@ -172,8 +172,7 @@
"""
index = {}
for d in list_of_dicts:
- if d[field_key] not in index:
- index[d[field_key]] = []
+ index.setdefault(d[field_key], [])
index[d[field_key]].append(d)
return index
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list