From d8b8792e778ba18585bbad25eed815feb5c60b08 2013-11-02 05:10:02 From: MinRK Date: 2013-11-02 05:10:02 Subject: [PATCH] reorder branches in Config.__getitem__ clearer and less duplication this way --- diff --git a/IPython/config/loader.py b/IPython/config/loader.py index 8dc7909..b358443 100644 --- a/IPython/config/loader.py +++ b/IPython/config/loader.py @@ -244,17 +244,14 @@ class Config(dict): return type(self)(copy.deepcopy(list(self.items()))) def __getitem__(self, key): - if _is_section_key(key): - try: - return dict.__getitem__(self, key) - except KeyError: + try: + return dict.__getitem__(self, key) + except KeyError: + if _is_section_key(key): c = Config() dict.__setitem__(self, key, c) return c - else: - try: - return dict.__getitem__(self, key) - except KeyError: + else: # undefined, create lazy value, used for container methods v = LazyConfigValue() dict.__setitem__(self, key, v)