From c7b50978e8a808aa69e6b000561d57fff0038416 Mon Sep 17 00:00:00 2001 From: Holger Sattel Date: Thu, 21 Apr 2016 09:36:21 +0200 Subject: [PATCH] config.py: speedup method BaseConfig._update(...) --- pygal/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pygal/config.py b/pygal/config.py index 4ce0395..c021222 100644 --- a/pygal/config.py +++ b/pygal/config.py @@ -168,9 +168,10 @@ class BaseConfig(MetaConfig('ConfigBase', (object,), {})): def _update(self, kwargs): """Update the config with the given dictionary""" + dir_self_set = set(dir(self)) self.__dict__.update( dict([(k, v) for (k, v) in kwargs.items() - if not k.startswith('_') and k in dir(self)])) + if not k.startswith('_') and k in dir_self_set])) def to_dict(self): """Export a JSON serializable dictionary of the config"""