Skip to content
Snippets Groups Projects
Commit cb3f8ec4 authored by Mikhail Rachinskiy's avatar Mikhail Rachinskiy
Browse files

PLY: avoid list to dict conversion

Use dictionary comprehension instead of converting list comprehension
to dictionary. Gives around 2.5% speedup, and will probably scale in
favor of dict comprehension.
parent 054ee2f4
No related branches found
No related tags found
No related merge requests found
......@@ -110,7 +110,12 @@ class ObjectSpec:
self.specs = []
def load(self, format, stream):
return dict([(i.name, [i.load(format, stream) for j in range(i.count)]) for i in self.specs])
return {
i.name: [
i.load(format, stream) for j in range(i.count)
]
for i in self.specs
}
# Longhand for above LC
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment