From 73e8b4800330d6840735e84e623434fe4823a7c5 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Mon, 7 Nov 2022 17:57:40 -0800 Subject: [PATCH] Add dotdict._to_dict. --- voussoirkit/dotdict.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/voussoirkit/dotdict.py b/voussoirkit/dotdict.py index 1d18213..5351bc8 100644 --- a/voussoirkit/dotdict.py +++ b/voussoirkit/dotdict.py @@ -28,10 +28,13 @@ class DotDict: def __setattr__(self, key, value): self.__dict__[key] = value - def __iter__(self): + def _to_dict(self): display = self.__dict__.copy() display.pop('_DotDict__default') - return iter(display.items()) + return display + + def __iter__(self): + return iter(self._to_dict().items()) def __repr__(self): display = self.__dict__.copy()