Performance improvement using in-operator for hash lookups

Just a small cleanup for the existing occurrences.

Using the in-operator for hash lookups is faster than using .has_key()
http://stackoverflow.com/questions/1323410/has-key-or-in
This commit is contained in:
Dag Wieers 2016-11-17 15:53:43 +01:00 committed by Matt Clay
commit c843eeabc2
2 changed files with 3 additions and 3 deletions

View file

@ -163,7 +163,7 @@ class Rhn(RegistrationBase):
def get_option_default(self, key, default=''):
# ignore pep8 W601 errors for this line
# setting this to use 'in' does not work in the rhn library
if self.has_key(key):
if key in self:
return self[key]
else:
return default