From 9bb5dc21ca2ca49dd82dc7f90c94816f49b30f61 Mon Sep 17 00:00:00 2001 From: Noam Bernstein Date: Thu, 3 Oct 2024 14:10:20 -0400 Subject: [PATCH] Overload '+' operator to concatenate ConfigSet objects --- wfl/configset.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wfl/configset.py b/wfl/configset.py index 3974c611..c1a6c74a 100644 --- a/wfl/configset.py +++ b/wfl/configset.py @@ -388,6 +388,12 @@ def _flat_iter(items): yield at + def __add__(self, other): + if not isinstance(other, ConfigSet): + raise TypeError(f"unsupported operand type(s) for +: 'ConfigSet' and '{type(other)}'") + return ConfigSet([self, other]) + + class OutputSpec: """Abstraction for writing to a ConfigSet, preserving tree structure.