From d42665705a8a04117effcc4f4ba7f3290bad5d03 2010-10-10 20:08:49 From: Thomas Kluyver Date: 2010-10-10 20:08:49 Subject: [PATCH] Tidy up dictionary-style methods of Config (2to3 converts 'has_key' calls to use the 'in' operator, which will be that of the parent dict unless we define it). --- diff --git a/IPython/config/loader.py b/IPython/config/loader.py index 21e5548..5800fd5 100644 --- a/IPython/config/loader.py +++ b/IPython/config/loader.py @@ -92,16 +92,17 @@ class Config(dict): else: return False - # .has_key is deprecated for dictionaries. - def has_key(self, key): + def __contains__(self, key): if self._is_section_key(key): return True else: - return key in self + return super(Config, self).__contains__(key) + # .has_key is deprecated for dictionaries. + has_key = __contains__ def _has_section(self, key): if self._is_section_key(key): - if key in self: + if super(Config, self).__contains__(key): return True return False