From eb622e5318d6732ad8306bfd5a9cf9ef9efebb86 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sun, 2 Sep 2018 21:36:48 -0400 Subject: [PATCH] Prefer dict `setdefault` vs membership tests --- korman/exporter/mesh.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/korman/exporter/mesh.py b/korman/exporter/mesh.py index 8fbf643..c7bb955 100644 --- a/korman/exporter/mesh.py +++ b/korman/exporter/mesh.py @@ -492,10 +492,8 @@ class MeshConverter(_MeshManager): self._report.msg("Exported hsGMaterial '{}' geometry into '{}'", geospan.material.name, dspan.key.name, indent=1) idx = dspan.addSourceSpan(geospan) - if dspan not in _diindices: - _diindices[dspan] = [idx,] - else: - _diindices[dspan].append(idx) + diidx = _diindices.setdefault(dspan, []) + diidx.append(idx) # Step 3.1: Harvest Span indices and create the DIIndices drawables = []